mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
This commit is contained in:
@ -8,7 +8,7 @@ import { applyLocalDates } from "discourse/lib/local-dates";
|
||||
import { cook } from "discourse/lib/text";
|
||||
import { INPUT_DELAY } from "discourse-common/config/environment";
|
||||
import computed, { debounce } from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from "discourse-i18n";
|
||||
import generateDateMarkup from "discourse/plugins/discourse-local-dates/lib/local-date-markup-generator";
|
||||
|
||||
export default class LocalDatesCreate extends Component {
|
||||
@ -215,35 +215,35 @@ export default class LocalDatesCreate extends Component {
|
||||
|
||||
return [
|
||||
{
|
||||
name: I18n.t(`${key}.every_day`),
|
||||
name: i18n(`${key}.every_day`),
|
||||
id: "1.days",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_week`),
|
||||
name: i18n(`${key}.every_week`),
|
||||
id: "1.weeks",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_two_weeks`),
|
||||
name: i18n(`${key}.every_two_weeks`),
|
||||
id: "2.weeks",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_month`),
|
||||
name: i18n(`${key}.every_month`),
|
||||
id: "1.months",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_two_months`),
|
||||
name: i18n(`${key}.every_two_months`),
|
||||
id: "2.months",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_three_months`),
|
||||
name: i18n(`${key}.every_three_months`),
|
||||
id: "3.months",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_six_months`),
|
||||
name: i18n(`${key}.every_six_months`),
|
||||
id: "6.months",
|
||||
},
|
||||
{
|
||||
name: I18n.t(`${key}.every_year`),
|
||||
name: i18n(`${key}.every_year`),
|
||||
id: "1.years",
|
||||
},
|
||||
];
|
||||
@ -288,7 +288,7 @@ export default class LocalDatesCreate extends Component {
|
||||
formattedTo(dateTime, toSelected) {
|
||||
const emptyText = toSelected
|
||||
? " "
|
||||
: I18n.t("discourse_local_dates.create.form.until");
|
||||
: i18n("discourse_local_dates.create.form.until");
|
||||
|
||||
return dateTime.isValid() ? dateTime.format("LLLL") : emptyText;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
} from "discourse/lib/to-markdown";
|
||||
import { iconHTML, renderIcon } from "discourse-common/lib/icon-library";
|
||||
import { bind } from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from "discourse-i18n";
|
||||
import generateDateMarkup from "discourse/plugins/discourse-local-dates/lib/local-date-markup-generator";
|
||||
import LocalDatesCreateModal from "../discourse/components/modal/local-dates-create";
|
||||
import LocalDateBuilder from "../lib/local-date-builder";
|
||||
@ -143,7 +143,7 @@ function _partitionedRanges(element) {
|
||||
|
||||
function initializeDiscourseLocalDates(api) {
|
||||
const siteSettings = api.container.lookup("service:site-settings");
|
||||
const defaultTitle = I18n.t("discourse_local_dates.default_title", {
|
||||
const defaultTitle = i18n("discourse_local_dates.default_title", {
|
||||
site_name: siteSettings.title,
|
||||
});
|
||||
|
||||
@ -312,7 +312,7 @@ function _downloadCalendarNode(element) {
|
||||
|
||||
const node = document.createElement("div");
|
||||
node.classList.add("download-calendar");
|
||||
node.innerHTML = `${renderIcon("string", "file")} ${I18n.t(
|
||||
node.innerHTML = `${renderIcon("string", "file")} ${i18n(
|
||||
"download_calendar.add_to_calendar"
|
||||
)}`;
|
||||
node.setAttribute("data-starts-at", startDate.toISOString());
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { renderIcon } from "discourse-common/lib/icon-library";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from "discourse-i18n";
|
||||
import DateWithZoneHelper from "./date-with-zone-helper";
|
||||
|
||||
const DATETIME_FORMAT = "LLL";
|
||||
@ -217,7 +217,7 @@ export default class LocalDateBuilder {
|
||||
if (diffTime < 0) {
|
||||
return moment.duration(diffTime).humanize();
|
||||
} else {
|
||||
return I18n.t("discourse_local_dates.relative_dates.countdown.passed");
|
||||
return i18n("discourse_local_dates.relative_dates.countdown.passed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ export default class LocalDateBuilder {
|
||||
}
|
||||
|
||||
_translateCalendarKey(time, key) {
|
||||
const translated = I18n.t(`discourse_local_dates.relative_dates.${key}`, {
|
||||
const translated = i18n(`discourse_local_dates.relative_dates.${key}`, {
|
||||
time: "LT",
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@ import sinon from "sinon";
|
||||
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
|
||||
acceptance(
|
||||
"Local Dates - Download calendar without default calendar option set",
|
||||
@ -30,7 +30,7 @@ acceptance(
|
||||
assert
|
||||
.dom("#discourse-modal-title")
|
||||
.hasText(
|
||||
I18n.t("download_calendar.title"),
|
||||
i18n("download_calendar.title"),
|
||||
"it should display modal to select calendar"
|
||||
);
|
||||
|
||||
@ -62,7 +62,7 @@ acceptance(
|
||||
assert
|
||||
.dom("#discourse-modal-title")
|
||||
.hasText(
|
||||
I18n.t("download_calendar.title"),
|
||||
i18n("download_calendar.title"),
|
||||
"it should display modal to select calendar"
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import QUnit, { module, test } from "qunit";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import freezeTime from "../helpers/freeze-time";
|
||||
import LocalDateBuilder from "../lib/local-date-builder";
|
||||
|
||||
@ -283,7 +283,7 @@ module("Unit | Library | local-date-builder", function () {
|
||||
timezone: PARIS,
|
||||
},
|
||||
{
|
||||
formatted: I18n.t(
|
||||
formatted: i18n(
|
||||
"discourse_local_dates.relative_dates.countdown.passed"
|
||||
),
|
||||
},
|
||||
|
Reference in New Issue
Block a user