Person,
PrivateMessageView,
} from "lemmy-js-client";
-import { i18n } from "../../i18next";
import { mdToHtml } from "../../markdown";
-import { UserService } from "../../services";
+import { I18NextService, UserService } from "../../services";
import { Icon, Spinner } from "../common/icon";
import { MomentTime } from "../common/moment-time";
import { PersonListing } from "../person/person-listing";
<ul className="list-inline mb-0 text-muted small">
{/* TODO refactor this */}
<li className="list-inline-item">
- {this.mine ? i18n.t("to") : i18n.t("from")}
+ {this.mine
+ ? I18NextService.i18n.t("to")
+ : I18NextService.i18n.t("from")}
</li>
<li className="list-inline-item">
<PersonListing person={otherPerson} />
onClick={linkEvent(this, this.handleMarkRead)}
data-tippy-content={
message_view.private_message.read
- ? i18n.t("mark_as_unread")
- : i18n.t("mark_as_read")
+ ? I18NextService.i18n.t("mark_as_unread")
+ : I18NextService.i18n.t("mark_as_read")
}
aria-label={
message_view.private_message.read
- ? i18n.t("mark_as_unread")
- : i18n.t("mark_as_read")
+ ? I18NextService.i18n.t("mark_as_unread")
+ : I18NextService.i18n.t("mark_as_read")
}
>
{this.state.readLoading ? (
<button
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(this, this.handleReplyClick)}
- data-tippy-content={i18n.t("reply")}
- aria-label={i18n.t("reply")}
+ data-tippy-content={I18NextService.i18n.t("reply")}
+ aria-label={I18NextService.i18n.t("reply")}
>
<Icon icon="reply1" classes="icon-inline" />
</button>
<button
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(this, this.handleEditClick)}
- data-tippy-content={i18n.t("edit")}
- aria-label={i18n.t("edit")}
+ data-tippy-content={I18NextService.i18n.t("edit")}
+ aria-label={I18NextService.i18n.t("edit")}
>
<Icon icon="edit" classes="icon-inline" />
</button>
onClick={linkEvent(this, this.handleDeleteClick)}
data-tippy-content={
!message_view.private_message.deleted
- ? i18n.t("delete")
- : i18n.t("restore")
+ ? I18NextService.i18n.t("delete")
+ : I18NextService.i18n.t("restore")
}
aria-label={
!message_view.private_message.deleted
- ? i18n.t("delete")
- : i18n.t("restore")
+ ? I18NextService.i18n.t("delete")
+ : I18NextService.i18n.t("restore")
}
>
{this.state.deleteLoading ? (
<button
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(this, this.handleViewSource)}
- data-tippy-content={i18n.t("view_source")}
- aria-label={i18n.t("view_source")}
+ data-tippy-content={I18NextService.i18n.t("view_source")}
+ aria-label={I18NextService.i18n.t("view_source")}
>
<Icon
icon="file-text"
onSubmit={linkEvent(this, this.handleReportSubmit)}
>
<label className="visually-hidden" htmlFor="pm-report-reason">
- {i18n.t("reason")}
+ {I18NextService.i18n.t("reason")}
</label>
<input
type="text"
id="pm-report-reason"
className="form-control me-2"
- placeholder={i18n.t("reason")}
+ placeholder={I18NextService.i18n.t("reason")}
required
value={this.state.reportReason}
onInput={linkEvent(this, this.handleReportReasonChange)}
<button
type="submit"
className="btn btn-secondary"
- aria-label={i18n.t("create_report")}
+ aria-label={I18NextService.i18n.t("create_report")}
>
- {this.state.reportLoading ? <Spinner /> : i18n.t("create_report")}
+ {this.state.reportLoading ? (
+ <Spinner />
+ ) : (
+ I18NextService.i18n.t("create_report")
+ )}
</button>
</form>
)}
<button
className="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleShowReportDialog)}
- data-tippy-content={i18n.t("show_report_dialog")}
- aria-label={i18n.t("show_report_dialog")}
+ data-tippy-content={I18NextService.i18n.t("show_report_dialog")}
+ aria-label={I18NextService.i18n.t("show_report_dialog")}
>
<Icon icon="flag" inline />
</button>
get messageUnlessRemoved(): string {
const message = this.props.private_message_view.private_message;
- return message.deleted ? `*${i18n.t("deleted")}*` : message.content;
+ return message.deleted
+ ? `*${I18NextService.i18n.t("deleted")}*`
+ : message.content;
}
handleReplyClick(i: PrivateMessage) {