TransferCommunity,
} from "lemmy-js-client";
import { fetchLimit, relTags } from "../../config";
-import { i18n } from "../../i18next";
import { CommentViewType, InitialFetchRequest } from "../../interfaces";
-import { UserService } from "../../services";
-import { FirstLoadService } from "../../services/FirstLoadService";
+import { FirstLoadService, I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast";
import { CommentNodes } from "../comment/comment-nodes";
get documentTitle(): string {
const mui = UserService.Instance.myUserInfo;
return mui
- ? `@${mui.local_user_view.person.name} ${i18n.t("inbox")} - ${
- this.state.siteRes.site_view.site.name
- }`
+ ? `@${mui.local_user_view.person.name} ${I18NextService.i18n.t(
+ "inbox"
+ )} - ${this.state.siteRes.site_view.site.name}`
: "";
}
path={this.context.router.route.match.url}
/>
<h5 className="mb-2">
- {i18n.t("inbox")}
+ {I18NextService.i18n.t("inbox")}
{inboxRss && (
<small>
<a href={inboxRss} title="RSS" rel={relTags}>
{this.state.markAllAsReadRes.state == "loading" ? (
<Spinner />
) : (
- i18n.t("mark_all_as_read")
+ I18NextService.i18n.t("mark_all_as_read")
)}
</button>
)}
checked={this.state.unreadOrAll == UnreadOrAll.Unread}
onChange={linkEvent(this, this.handleUnreadOrAllChange)}
/>
- {i18n.t("unread")}
+ {I18NextService.i18n.t("unread")}
</label>
<label
className={`btn btn-outline-secondary pointer
checked={this.state.unreadOrAll == UnreadOrAll.All}
onChange={linkEvent(this, this.handleUnreadOrAllChange)}
/>
- {i18n.t("all")}
+ {I18NextService.i18n.t("all")}
</label>
</div>
);
checked={this.state.messageType == MessageType.All}
onChange={linkEvent(this, this.handleMessageTypeChange)}
/>
- {i18n.t("all")}
+ {I18NextService.i18n.t("all")}
</label>
<label
className={`btn btn-outline-secondary pointer
checked={this.state.messageType == MessageType.Replies}
onChange={linkEvent(this, this.handleMessageTypeChange)}
/>
- {i18n.t("replies")}
+ {I18NextService.i18n.t("replies")}
</label>
<label
className={`btn btn-outline-secondary pointer
checked={this.state.messageType == MessageType.Mentions}
onChange={linkEvent(this, this.handleMessageTypeChange)}
/>
- {i18n.t("mentions")}
+ {I18NextService.i18n.t("mentions")}
</label>
<label
className={`btn btn-outline-secondary pointer
checked={this.state.messageType == MessageType.Messages}
onChange={linkEvent(this, this.handleMessageTypeChange)}
/>
- {i18n.t("messages")}
+ {I18NextService.i18n.t("messages")}
</label>
</div>
);
const res = await HttpService.client.createComment(form);
if (res.state === "success") {
- toast(i18n.t("reply_sent"));
+ toast(I18NextService.i18n.t("reply_sent"));
this.findAndUpdateComment(res);
}
const res = await HttpService.client.editComment(form);
if (res.state === "success") {
- toast(i18n.t("edit"));
+ toast(I18NextService.i18n.t("edit"));
this.findAndUpdateComment(res);
} else if (res.state === "failed") {
toast(res.msg, "danger");
async handleDeleteComment(form: DeleteComment) {
const res = await HttpService.client.deleteComment(form);
if (res.state == "success") {
- toast(i18n.t("deleted"));
+ toast(I18NextService.i18n.t("deleted"));
this.findAndUpdateComment(res);
}
}
async handleRemoveComment(form: RemoveComment) {
const res = await HttpService.client.removeComment(form);
if (res.state == "success") {
- toast(i18n.t("remove_comment"));
+ toast(I18NextService.i18n.t("remove_comment"));
this.findAndUpdateComment(res);
}
}
async handleTransferCommunity(form: TransferCommunity) {
await HttpService.client.transferCommunity(form);
- toast(i18n.t("transfer_community"));
+ toast(I18NextService.i18n.t("transfer_community"));
}
async handleCommentReplyRead(form: MarkCommentReplyAsRead) {
purgeItem(purgeRes: RequestState<PurgeItemResponse>) {
if (purgeRes.state == "success") {
- toast(i18n.t("purge_success"));
+ toast(I18NextService.i18n.t("purge_success"));
this.context.router.history.push(`/`);
}
}
res: RequestState<PrivateMessageReportResponse | CommentReportResponse>
) {
if (res.state == "success") {
- toast(i18n.t("report_created"));
+ toast(I18NextService.i18n.t("report_created"));
}
}