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:
David Taylor 2024-11-19 20:45:18 +00:00 committed by GitHub
parent 187b7d74fb
commit 32665cf9dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
909 changed files with 3453 additions and 3591 deletions

View File

@ -4,7 +4,7 @@ import { service } from "@ember/service";
import routeAction from "discourse/helpers/route-action";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminBackupsActions extends Component {
@service currentUser;
@ -15,7 +15,7 @@ export default class AdminBackupsActions extends Component {
toggleReadOnlyMode() {
if (!this.site.isReadOnly) {
this.dialog.yesNoConfirm({
message: I18n.t("admin.backups.read_only.enable.confirm"),
message: i18n("admin.backups.read_only.enable.confirm"),
didConfirm: () => {
this.currentUser.set("hideReadOnlyAlert", true);
this.#toggleReadOnlyMode(true);

View File

@ -3,13 +3,13 @@ import { scheduleOnce } from "@ember/runloop";
import { classNames } from "@ember-decorators/component";
import { observes, on } from "@ember-decorators/object";
import discourseDebounce from "discourse-common/lib/debounce";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
@classNames("admin-backups-logs")
export default class AdminBackupsLogs extends Component {
showLoadingSpinner = false;
hasFormattedLogs = false;
noLogsMessage = I18n.t("admin.backups.logs.none");
noLogsMessage = i18n("admin.backups.logs.none");
formattedLogs = "";
index = 0;

View File

@ -1,13 +1,13 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminConfigAreaCard extends Component {
@tracked collapsed = false;
get computedHeading() {
if (this.args.heading) {
return I18n.t(this.args.heading);
return i18n(this.args.heading);
}
return this.args.translatedHeading;
}
@ -18,7 +18,7 @@ export default class AdminConfigAreaCard extends Component {
get computedDescription() {
if (this.args.description) {
return I18n.t(this.args.description);
return i18n(this.args.description);
}
return this.args.translatedDescription;
}

View File

@ -6,8 +6,7 @@ import { service } from "@ember/service";
import Form from "discourse/components/form";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import GroupChooser from "select-kit/components/group-chooser";
import UserChooser from "select-kit/components/user-chooser";
@ -65,7 +64,7 @@ export default class AdminConfigAreasAboutContactInformation extends Component {
this.toasts.success({
duration: 3000,
data: {
message: I18n.t(
message: i18n(
"admin.config_areas.about.toasts.contact_information_saved"
),
},

View File

@ -5,8 +5,7 @@ import { service } from "@ember/service";
import Form from "discourse/components/form";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminConfigAreasAboutGeneralSettings extends Component {
@service toasts;
@ -47,7 +46,7 @@ export default class AdminConfigAreasAboutGeneralSettings extends Component {
this.toasts.success({
duration: 3000,
data: {
message: I18n.t(
message: i18n(
"admin.config_areas.about.toasts.general_settings_saved"
),
},

View File

@ -5,8 +5,7 @@ import { service } from "@ember/service";
import Form from "discourse/components/form";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminConfigAreasAboutYourOrganization extends Component {
@service toasts;
@ -41,7 +40,7 @@ export default class AdminConfigAreasAboutYourOrganization extends Component {
this.toasts.success({
duration: 30000,
data: {
message: I18n.t(
message: i18n(
"admin.config_areas.about.toasts.your_organization_saved"
),
},

View File

@ -1,6 +1,6 @@
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
const AdminConfigAreaEmptyList = <template>
<div class="admin-config-area-empty-list">

View File

@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { fn } from "@ember/helper";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
import ComboBox from "select-kit/components/combo-box";

View File

@ -4,8 +4,8 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import { ajax } from "discourse/lib/ajax";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import { i18n } from "discourse-i18n";
import AdminFilteredSiteSettings from "admin/components/admin-filtered-site-settings";
import SiteSetting from "admin/models/site-setting";

View File

@ -4,8 +4,8 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import { ajax } from "discourse/lib/ajax";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import { i18n } from "discourse-i18n";
import AdminFilteredSiteSettings from "admin/components/admin-filtered-site-settings";
import SiteSetting from "admin/models/site-setting";

View File

@ -5,8 +5,8 @@ import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { SYSTEM_FLAG_IDS } from "discourse/lib/constants";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import { i18n } from "discourse-i18n";
import AdminFlagItem from "admin/components/admin-flag-item";
export default class AdminConfigAreasFlags extends Component {

View File

@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminPageSubheader from "admin/components/admin-page-subheader";
import InstallThemeModal from "admin/components/modal/install-theme";
import ThemesGrid from "admin/components/themes-grid";
@ -37,7 +37,7 @@ export default class AdminConfigAreasLookAndFeelThemes extends Component {
addTheme(theme) {
this.toasts.success({
data: {
message: I18n.t("admin.customize.theme.install_success", {
message: i18n("admin.customize.theme.install_success", {
theme: theme.name,
}),
},

View File

@ -6,8 +6,8 @@ import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import SiteSettingFilter from "discourse/lib/site-setting-filter";
import i18n from "discourse-common/helpers/i18n";
import discourseDebounce from "discourse-common/lib/debounce";
import { i18n } from "discourse-i18n";
import AdminSiteSettingsFilterControls from "admin/components/admin-site-settings-filter-controls";
import SiteSetting from "admin/components/site-setting";

View File

@ -13,7 +13,7 @@ import concatClass from "discourse/helpers/concat-class";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { SYSTEM_FLAG_IDS } from "discourse/lib/constants";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import DMenu from "float-kit/components/d-menu";
export default class AdminFlagItem extends Component {

View File

@ -7,9 +7,8 @@ import BackButton from "discourse/components/back-button";
import Form from "discourse/components/form";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import MultiSelect from "select-kit/components/multi-select";
@ -50,7 +49,7 @@ export default class AdminFlagsForm extends Component {
get appliesToValues() {
return this.site.valid_flag_applies_to_types.map((type) => {
return {
name: I18n.t(
name: i18n(
`admin.config_areas.flags.form.${type
.toLowerCase()
.replace("::", "_")}`

View File

@ -7,7 +7,7 @@ import DBreadcrumbsContainer from "discourse/components/d-breadcrumbs-container"
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DropdownMenu from "discourse/components/dropdown-menu";
import HorizontalOverflowNav from "discourse/components/horizontal-overflow-nav";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import {
DangerActionListItem,
DangerButton,

View File

@ -3,7 +3,7 @@ import { hash } from "@ember/helper";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import DropdownMenu from "discourse/components/dropdown-menu";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import {
DangerActionListItem,
DangerButton,

View File

@ -4,7 +4,7 @@ import { equal } from "@ember/object/computed";
import discourseComputed, {
afterRender,
} from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const ACTIONS = ["delete", "delete_replies", "edit", "none"];
@ -17,7 +17,7 @@ export default class AdminPenaltyPostAction extends Component {
@discourseComputed
penaltyActions() {
return ACTIONS.map((id) => {
return { id, name: I18n.t(`admin.user.penalty_post_${id}`) };
return { id, name: i18n(`admin.user.penalty_post_${id}`) };
});
}

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { equal } from "@ember/object/computed";
import { tagName } from "@ember-decorators/component";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const CUSTOM_REASON_KEY = "custom";
@ -26,7 +26,7 @@ export default class AdminPenaltyReason extends Component {
@discourseComputed("reasonKeys")
reasons(keys) {
return keys.map((key) => {
return { id: key, name: I18n.t(`admin.user.suspend_reasons.${key}`) };
return { id: key, name: i18n(`admin.user.suspend_reasons.${key}`) };
});
}
@ -48,7 +48,7 @@ export default class AdminPenaltyReason extends Component {
} else {
this.set(
"reason",
I18n.t(`admin.user.suspend_reasons.${this.selectedReason}`)
i18n(`admin.user.suspend_reasons.${this.selectedReason}`)
);
}
}

View File

@ -8,8 +8,8 @@ import { eq } from "truth-helpers";
import BackButton from "discourse/components/back-button";
import Form from "discourse/components/form";
import { popupAjaxError } from "discourse/lib/ajax-error";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import { i18n } from "discourse-i18n";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import Permalink from "admin/models/permalink";

View File

@ -2,14 +2,14 @@ import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import concatClass from "discourse/helpers/concat-class";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminPluginConfigArea extends Component {
@service adminPluginNavManager;
linkText(navLink) {
if (navLink.label) {
return I18n.t(navLink.label);
return i18n(navLink.label);
} else {
return navLink.text;
}

View File

@ -3,7 +3,7 @@ import { service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import NavItem from "discourse/components/nav-item";
import { headerActionComponentForPlugin } from "discourse/lib/admin-plugin-header-actions";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import AdminPageHeader from "./admin-page-header";
import AdminPluginConfigArea from "./admin-plugin-config-area";

View File

@ -8,7 +8,7 @@ import DToggleSwitch from "discourse/components/d-toggle-switch";
import PluginOutlet from "discourse/components/plugin-outlet";
import { popupAjaxError } from "discourse/lib/ajax-error";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import SiteSetting from "admin/models/site-setting";
import PluginCommitHash from "./plugin-commit-hash";

View File

@ -1,4 +1,4 @@
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import AdminPluginsListItem from "./admin-plugins-list-item";
const AdminPluginsList = <template>

View File

@ -3,7 +3,7 @@ import { alias } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
import { setting } from "discourse/lib/computed";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import I18n, { i18n } from "discourse-i18n";
@classNames("admin-report-storage-stats")
export default class AdminReportStorageStats extends Component {
@ -20,7 +20,7 @@ export default class AdminReportStorageStats extends Component {
@discourseComputed("backupLocation")
backupLocationName(backupLocation) {
return I18n.t(`admin.backups.location.${backupLocation}`);
return i18n(`admin.backups.location.${backupLocation}`);
}
@discourseComputed("backupStats.used_bytes")

View File

@ -10,7 +10,7 @@ import ReportLoader from "discourse/lib/reports-loader";
import { isTesting } from "discourse-common/config/environment";
import { makeArray } from "discourse-common/lib/helpers";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import Report, { DAILY_LIMIT_DAYS, SCHEMA_VERSION } from "admin/models/report";
const TABLE_OPTIONS = {
@ -32,7 +32,7 @@ const CHART_OPTIONS = {};
@classNames("admin-report")
export default class AdminReport extends Component {
isEnabled = true;
disabledLabel = I18n.t("admin.dashboard.disabled");
disabledLabel = i18n("admin.dashboard.disabled");
isLoading = false;
rateLimitationString = null;
dataSourceName = null;
@ -336,7 +336,7 @@ export default class AdminReport extends Component {
if (response === 429) {
this.set(
"rateLimitationString",
I18n.t("admin.dashboard.too_many_requests")
i18n("admin.dashboard.too_many_requests")
);
} else if (response === 500) {
this.set("model.error", "exception");

View File

@ -8,8 +8,8 @@ import { htmlSafe } from "@ember/template";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import { ajax } from "discourse/lib/ajax";
import dIcon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import { i18n } from "discourse-i18n";
export default class AdminReports extends Component {
@service siteSettings;

View File

@ -3,7 +3,7 @@ import { hash } from "@ember/helper";
import { LinkTo } from "@ember/routing";
import concatClass from "discourse/helpers/concat-class";
import dIcon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import {
DangerButton,
DefaultButton,

View File

@ -6,7 +6,7 @@ import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
import DButton from "discourse/components/d-button";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
export default class AdminSiteSettingsFilterControls extends Component {
@tracked filter = this.args.initialFilter || "";

View File

@ -4,7 +4,7 @@ import { next } from "@ember/runloop";
import { fmt } from "discourse/lib/computed";
import { isDocumentRTL } from "discourse/lib/text-direction";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminThemeEditor extends Component {
warning = null;
@ -55,7 +55,7 @@ export default class AdminThemeEditor extends Component {
" --mytheme-tertiary-or-highlight: #{dark-light-choose($tertiary, $highlight)};\n" +
"}";
return I18n.t("admin.customize.theme.color_definitions.placeholder", {
return i18n("admin.customize.theme.color_definitions.placeholder", {
example: isDocumentRTL() ? `<div dir="ltr">${example}</div>` : example,
});
}

View File

@ -7,7 +7,7 @@ import { isEmpty } from "@ember/utils";
import { tagName } from "@ember-decorators/component";
import { Promise } from "rsvp";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import UserField from "admin/models/user-field";
@tagName("")
@ -48,7 +48,7 @@ export default class AdminUserFieldItem extends Component {
return flags
.map((flag) => {
if (this.args.userField[flag]) {
return I18n.t(`admin.user_fields.${flag}.enabled`);
return i18n(`admin.user_fields.${flag}.enabled`);
}
})
.filter(Boolean)
@ -114,7 +114,7 @@ export default class AdminUserFieldItem extends Component {
async _confirmChanges() {
return new Promise((resolve) => {
this.dialog.yesNoConfirm({
message: I18n.t("admin.user_fields.requirement.confirmation"),
message: i18n("admin.user_fields.requirement.confirmation"),
didCancel: () => resolve(false),
didConfirm: () => resolve(true),
});

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { eq, or } from "truth-helpers";
import DButton from "discourse/components/d-button";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
export default class AdminWatchedWord extends Component {
@service dialog;

View File

@ -10,9 +10,8 @@ import DToggleSwitch from "discourse/components/d-toggle-switch";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import dIcon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import DTooltip from "float-kit/components/d-tooltip";
export default class DiscourseNewFeatureItem extends Component {
@ -33,7 +32,7 @@ export default class DiscourseNewFeatureItem extends Component {
this.toasts.error({
duration: 3000,
data: {
message: I18n.t(
message: i18n(
"admin.dashboard.new_features.experiment_toggled_too_fast"
),
},
@ -57,8 +56,8 @@ export default class DiscourseNewFeatureItem extends Component {
duration: 3000,
data: {
message: this.experimentEnabled
? I18n.t("admin.dashboard.new_features.experiment_enabled")
: I18n.t("admin.dashboard.new_features.experiment_disabled"),
? i18n("admin.dashboard.new_features.experiment_enabled")
: i18n("admin.dashboard.new_features.experiment_disabled"),
},
});
} catch (error) {

View File

@ -4,8 +4,8 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { ajax } from "discourse/lib/ajax";
import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import { i18n } from "discourse-i18n";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import DashboardNewFeatureItem from "admin/components/dashboard-new-feature-item";

View File

@ -8,7 +8,7 @@ import concatClass from "discourse/helpers/concat-class";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import AdminNotice from "admin/components/admin-notice";
export default class DashboardProblems extends Component {

View File

@ -3,7 +3,7 @@ import { action, computed } from "@ember/object";
import { reads } from "@ember/object/computed";
import { service } from "@ember/service";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class EmailStylesEditor extends Component {
@service dialog;
@ -35,8 +35,8 @@ export default class EmailStylesEditor extends Component {
@action
reset() {
this.dialog.yesNoConfirm({
message: I18n.t("admin.customize.email_style.reset_confirm", {
fieldName: I18n.t(`admin.customize.email_style.${this.fieldName}`),
message: i18n("admin.customize.email_style.reset_confirm", {
fieldName: i18n(`admin.customize.email_style.${this.fieldName}`),
}),
didConfirm: () => {
this.styles.setField(

View File

@ -8,7 +8,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import Category from "discourse/models/category";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
@tagName("tr")
export default class EmbeddableHost extends Component.extend(
@ -77,7 +77,7 @@ export default class EmbeddableHost extends Component.extend(
@action
delete() {
return this.dialog.confirm({
message: I18n.t("admin.embedding.confirm_delete"),
message: i18n("admin.embedding.confirm_delete"),
didConfirm: () => {
return this.host.destroyRecord().then(() => {
this.deleteHost(this.host);

View File

@ -5,7 +5,7 @@ import { getOwner } from "@ember/owner";
import { isEmpty } from "@ember/utils";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const DEFAULT_GROUP = "default";
export default class EmojiUploader extends Component {
@ -74,9 +74,9 @@ export default class EmojiUploader extends Component {
@discourseComputed("uppyUpload.uploading", "uppyUpload.uploadProgress")
buttonLabel(uploading, uploadProgress) {
if (uploading) {
return `${I18n.t("admin.emoji.uploading")} ${uploadProgress}%`;
return `${i18n("admin.emoji.uploading")} ${uploadProgress}%`;
} else {
return I18n.t("admin.emoji.choose_files");
return i18n("admin.emoji.choose_files");
}
}

View File

@ -5,7 +5,7 @@ import { classNameBindings } from "@ember-decorators/component";
import { emojiUrlFor } from "discourse/lib/text";
import discourseLater from "discourse-common/lib/later";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
@classNameBindings(":value-list", ":emoji-list")
export default class EmojiValueList extends Component {
@ -138,7 +138,7 @@ export default class EmojiValueList extends Component {
_validateInput(input) {
if (!emojiUrlFor(input)) {
this.setValidationMessage(
I18n.t("admin.site_settings.emoji_list.invalid_input")
i18n("admin.site_settings.emoji_list.invalid_input")
);
return false;
}

View File

@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { allowOnlyNumericInput } from "discourse/lib/utilities";
import I18n from "discourse-i18n";
import I18n, { i18n } from "discourse-i18n";
import ComboBox from "select-kit/components/combo-box";
const UNIT_KB = "kb";
@ -49,9 +49,9 @@ export default class FileSizeInput extends Component {
get dropdownOptions() {
return [
{ label: I18n.t("number.human.storage_units.units.kb"), value: UNIT_KB },
{ label: I18n.t("number.human.storage_units.units.mb"), value: UNIT_MB },
{ label: I18n.t("number.human.storage_units.units.gb"), value: UNIT_GB },
{ label: i18n("number.human.storage_units.units.kb"), value: UNIT_KB },
{ label: i18n("number.human.storage_units.units.mb"), value: UNIT_MB },
{ label: i18n("number.human.storage_units.units.gb"), value: UNIT_GB },
];
}
@ -81,14 +81,14 @@ export default class FileSizeInput extends Component {
if (sizeInKB > this.args.max) {
this.args.setValidationMessage(
I18n.t("file_size_input.error.size_too_large", {
i18n("file_size_input.error.size_too_large", {
provided_file_size: I18n.toHumanSize(sizeInKB * 1024),
max_file_size: I18n.toHumanSize(this.args.max * 1024),
})
);
} else if (sizeInKB < this.args.min) {
this.args.setValidationMessage(
I18n.t("file_size_input.error.size_too_small", {
i18n("file_size_input.error.size_too_small", {
provided_file_size: I18n.toHumanSize(sizeInKB * 1024),
min_file_size: I18n.toHumanSize(this.args.min * 1024),
})

View File

@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import FormTemplateValidationOptionsModal from "admin/components/modal/form-template-validation-options";
import { templateFormFields } from "admin/lib/template-form-fields";
import FormTemplate from "admin/models/form-template";
@ -91,7 +91,7 @@ export default class FormTemplateForm extends Component {
@action
onDelete() {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.form_templates.delete_confirm"),
message: i18n("admin.form_templates.delete_confirm"),
didConfirm: () => {
FormTemplate.deleteTemplate(this.args.model.id)
.then(() => {

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class FormTemplateRowItem extends Component {
@service router;
@ -27,7 +27,7 @@ export default class FormTemplateRowItem extends Component {
@action
deleteTemplate() {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.form_templates.delete_confirm", {
message: i18n("admin.form_templates.delete_confirm", {
template_name: this.args.template.name,
}),
didConfirm: () => {

View File

@ -2,7 +2,7 @@ import Component from "@ember/component";
import { getOwner } from "@ember/owner";
import { tagName } from "@ember-decorators/component";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
@tagName("span")
export default class ImagesUploader extends Component {
@ -22,6 +22,6 @@ export default class ImagesUploader extends Component {
}
get uploadButtonText() {
return this.uploadingOrProcessing ? I18n.t("uploading") : I18n.t("upload");
return this.uploadingOrProcessing ? i18n("uploading") : i18n("upload");
}
}

View File

@ -1,6 +1,6 @@
import RadioButton from "discourse/components/radio-button";
import dIcon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
const InstallThemeItem = <template>
<div class="install-theme-item">

View File

@ -8,7 +8,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import copyText from "discourse/lib/copy-text";
import discourseLater from "discourse-common/lib/later";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminUser from "admin/models/admin-user";
@classNames("ip-lookup")
@ -67,18 +67,18 @@ export default class IpLookup extends Component {
const location = this.location;
if (location) {
if (location.hostname) {
text += `${I18n.t("ip_lookup.hostname")}: ${location.hostname}\n`;
text += `${i18n("ip_lookup.hostname")}: ${location.hostname}\n`;
}
text += I18n.t("ip_lookup.location");
text += i18n("ip_lookup.location");
if (location.location) {
text += `: ${location.location}\n`;
} else {
text += `: ${I18n.t("ip_lookup.location_not_found")}\n`;
text += `: ${i18n("ip_lookup.location_not_found")}\n`;
}
if (location.organization) {
text += I18n.t("ip_lookup.organisation");
text += i18n("ip_lookup.organisation");
text += `: ${location.organization}\n`;
}
}
@ -96,7 +96,7 @@ export default class IpLookup extends Component {
@action
deleteOtherAccounts() {
this.dialog.yesNoConfirm({
message: I18n.t("ip_lookup.confirm_delete_other_accounts"),
message: i18n("ip_lookup.confirm_delete_other_accounts"),
didConfirm: () => {
this.setProperties({
other_accounts: null,

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { escapeExpression } from "discourse/lib/utilities";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class BadgePreview extends Component {
get processedSample() {
@ -18,11 +18,11 @@ export default class BadgePreview extends Component {
if (grant.granted_at) {
i18nKey += "_time";
i18nParams.time = escapeExpression(
moment(grant.granted_at).format(I18n.t("dates.long_with_year"))
moment(grant.granted_at).format(i18n("dates.long_with_year"))
);
}
return I18n.t(i18nKey, i18nParams);
return i18n(i18nKey, i18nParams);
});
}

View File

@ -1,12 +1,12 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class DeletePostsConfirmation extends Component {
@tracked value;
get text() {
return I18n.t("admin.user.delete_posts.confirmation.text", {
return i18n("admin.user.delete_posts.confirmation.text", {
username: this.args.model.user.username,
post_count: this.args.model.user.post_count,
});

View File

@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { extractError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminUser from "admin/models/admin-user";
export default class DeleteUserPostsProgress extends Component {
@ -36,7 +36,7 @@ export default class DeleteUserPostsProgress extends Component {
AdminUser.find(this.args.model.user.id).then((u) =>
this.args.model.user.setProperties(u)
);
this.flash = extractError(e, I18n.t("admin.user.delete_posts_failed"));
this.flash = extractError(e, i18n("admin.user.delete_posts_failed"));
}
}
}

View File

@ -5,7 +5,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { TrackedArray } from "@ember-compat/tracked-built-ins";
import { ajax } from "discourse/lib/ajax";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class EditBadgeGroupings extends Component {
@service dialog;
@ -43,7 +43,7 @@ export default class EditBadgeGroupings extends Component {
add() {
const obj = this.store.createRecord("badge-grouping", {
editing: true,
name: I18n.t("admin.badges.badge_grouping"),
name: i18n("admin.badges.badge_grouping"),
});
this.workingCopy.pushObject(obj);
}
@ -69,7 +69,7 @@ export default class EditBadgeGroupings extends Component {
this.args.model.updateGroupings(this.workingCopy);
this.args.closeModal();
} catch {
this.dialog.alert(I18n.t("generic_error"));
this.dialog.alert(i18n("generic_error"));
}
}

View File

@ -1,5 +1,5 @@
import Component from "@glimmer/component";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const TABLE_HEADER_KEYS = ["key", "type", "description"];
const VALIDATION_KEYS = ["required", "minimum", "maximum", "pattern", "type"];
@ -9,7 +9,7 @@ export default class FormTemplateValidationOptions extends Component {
const translatedHeaders = [];
TABLE_HEADER_KEYS.forEach((header) => {
translatedHeaders.push(
I18n.t(`admin.form_templates.validations_modal.table_headers.${header}`)
i18n(`admin.form_templates.validations_modal.table_headers.${header}`)
);
});
@ -21,9 +21,9 @@ export default class FormTemplateValidationOptions extends Component {
const prefix = "admin.form_templates.validations_modal.validations";
VALIDATION_KEYS.forEach((validation) => {
translatedValidations.push({
key: I18n.t(`${prefix}.${validation}.key`),
type: I18n.t(`${prefix}.${validation}.type`),
description: I18n.t(`${prefix}.${validation}.description`),
key: i18n(`${prefix}.${validation}.key`),
type: i18n(`${prefix}.${validation}.type`),
description: i18n(`${prefix}.${validation}.description`),
});
});

View File

@ -14,17 +14,16 @@ import withEventValue from "discourse/helpers/with-event-value";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import dIcon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { POPULAR_THEMES } from "discourse-common/lib/popular-themes";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import InstallThemeItem from "admin/components/install-theme-item";
import { COMPONENTS, THEMES } from "admin/models/theme";
import ComboBox from "select-kit/components/combo-box";
const MIN_NAME_LENGTH = 4;
const CREATE_TYPES = [
{ name: I18n.t("admin.customize.theme.theme"), value: THEMES },
{ name: I18n.t("admin.customize.theme.component"), value: COMPONENTS },
{ name: i18n("admin.customize.theme.theme"), value: THEMES },
{ name: i18n("admin.customize.theme.component"), value: COMPONENTS },
];
export default class InstallThemeModal extends Component {
@ -98,9 +97,9 @@ export default class InstallThemeModal extends Component {
get placeholder() {
if (this.component) {
return I18n.t("admin.customize.theme.component_name");
return i18n("admin.customize.theme.component_name");
} else {
return I18n.t("admin.customize.theme.theme_name");
return i18n("admin.customize.theme.theme_name");
}
}
@ -200,7 +199,7 @@ export default class InstallThemeModal extends Component {
this.themeHasSameUrl(theme, this.uploadUrl)
);
if (duplicate && !this.duplicateRemoteThemeWarning) {
const warning = I18n.t("admin.customize.theme.duplicate_remote_theme", {
const warning = i18n("admin.customize.theme.duplicate_remote_theme", {
name: duplicate.name,
});
this.duplicateRemoteThemeWarning = warning;
@ -234,9 +233,7 @@ export default class InstallThemeModal extends Component {
if (!this.publicKey || this.themeCannotBeInstalled) {
return popupAjaxError(err);
}
this.themeCannotBeInstalled = I18n.t(
"admin.customize.theme.force_install"
);
this.themeCannotBeInstalled = i18n("admin.customize.theme.force_install");
} finally {
this.loading = false;
}

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class MergeUsersConfirmation extends Component {
@tracked value;
@ -10,7 +10,7 @@ export default class MergeUsersConfirmation extends Component {
}
get text() {
return I18n.t("admin.user.merge.confirmation.text", {
return i18n("admin.user.merge.confirmation.text", {
username: this.args.model.username,
targetUsername: this.args.model.targetUsername,
});

View File

@ -3,12 +3,12 @@ import { tracked } from "@glimmer/tracking";
import { service } from "@ember/service";
import DiscourseURL from "discourse/lib/url";
import { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class MergeUsersProgress extends Component {
@service messageBus;
@tracked message = I18n.t("admin.user.merging_user");
@tracked message = i18n("admin.user.merging_user");
constructor() {
super(...arguments);
@ -33,7 +33,7 @@ export default class MergeUsersProgress extends Component {
} else if (data.message) {
this.message = data.message;
} else if (data.failed) {
this.message = I18n.t("admin.user.merge_failed");
this.message = i18n("admin.user.merge_failed");
}
}
}

View File

@ -4,7 +4,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { extractError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import I18n, { i18n } from "discourse-i18n";
export default class PenalizeUser extends Component {
@service dialog;
@ -114,7 +114,7 @@ export default class PenalizeUser extends Component {
warnBeforeClosing() {
if (!this.confirmClose && (this.reason?.length || this.message?.length)) {
this.dialog.confirm({
message: I18n.t("admin.user.confirm_cancel_penalty"),
message: i18n("admin.user.confirm_cancel_penalty"),
didConfirm: () => this.args.closeModal(),
});
return false;

View File

@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class Reseed extends Component {
@service dialog;
@ -49,7 +49,7 @@ export default class Reseed extends Component {
this.flash = null;
this.args.closeModal();
} catch {
this.flash = I18n.t("generic_error");
this.flash = i18n("generic_error");
} finally {
this.reseeding = false;
}

View File

@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class StartBackup extends Component {
@service siteSettings;
@ -24,7 +24,7 @@ export default class StartBackup extends Component {
this.siteSettings.enable_s3_uploads &&
!this.siteSettings.include_s3_uploads_in_backups
) {
return I18n.t("admin.backups.operations.backup.s3_upload_warning");
return i18n("admin.backups.operations.backup.s3_upload_warning");
}
return "";
}

View File

@ -3,7 +3,7 @@ import { tracked } from "@glimmer/tracking";
import { Textarea } from "@ember/component";
import { or } from "truth-helpers";
import DModal from "discourse/components/d-modal";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
export default class WatchedWordTesting extends Component {
@tracked value;

View File

@ -5,7 +5,7 @@ import { service } from "@ember/service";
import { tagName } from "@ember-decorators/component";
import { fmt } from "discourse/lib/computed";
import discourseComputed, { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import Permalink from "admin/models/permalink";
@tagName("")
@ -23,12 +23,12 @@ export default class PermalinkForm extends Component {
@discourseComputed
permalinkTypes() {
return [
{ id: "topic_id", name: I18n.t("admin.permalink.topic_id") },
{ id: "post_id", name: I18n.t("admin.permalink.post_id") },
{ id: "category_id", name: I18n.t("admin.permalink.category_id") },
{ id: "tag_name", name: I18n.t("admin.permalink.tag_name") },
{ id: "external_url", name: I18n.t("admin.permalink.external_url") },
{ id: "user_id", name: I18n.t("admin.permalink.user_id") },
{ id: "topic_id", name: i18n("admin.permalink.topic_id") },
{ id: "post_id", name: i18n("admin.permalink.post_id") },
{ id: "category_id", name: i18n("admin.permalink.category_id") },
{ id: "tag_name", name: i18n("admin.permalink.tag_name") },
{ id: "external_url", name: i18n("admin.permalink.external_url") },
{ id: "user_id", name: i18n("admin.permalink.user_id") },
];
}
@ -74,11 +74,11 @@ export default class PermalinkForm extends Component {
let error;
if (e?.jqXHR?.responseJSON?.errors) {
error = I18n.t("generic_error_with_reason", {
error = i18n("generic_error_with_reason", {
error: e.jqXHR.responseJSON.errors.join(". "),
});
} else {
error = I18n.t("generic_error");
error = i18n("generic_error");
}
this.dialog.alert({

View File

@ -7,7 +7,7 @@ import { gt } from "truth-helpers";
import DButton from "discourse/components/d-button";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { cloneJSON } from "discourse-common/lib/object";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import Tree from "admin/components/schema-theme-setting/editor/tree";
import FieldInput from "admin/components/schema-theme-setting/field";
@ -68,7 +68,7 @@ export default class SchemaThemeSettingNewEditor extends Component {
const lastHistory = this.history[this.history.length - 1];
return I18n.t("admin.customize.theme.schema.back_button", {
return i18n("admin.customize.theme.schema.back_button", {
name: this.generateSchemaTitle(
this.#resolveDataFromPaths(lastHistory.dataPaths)[lastHistory.index],
this.#resolveSchemaFromPaths(lastHistory.schemaPaths),

View File

@ -4,7 +4,7 @@ import { Input } from "@ember/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { and, not } from "truth-helpers";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import FieldInputDescription from "admin/components/schema-theme-setting/field-input-description";
export default class SchemaThemeSettingNumberField extends Component {
@ -43,20 +43,20 @@ export default class SchemaThemeSettingNumberField extends Component {
if (!this.value) {
if (this.required) {
return I18n.t("admin.customize.theme.schema.fields.required");
return i18n("admin.customize.theme.schema.fields.required");
} else {
return;
}
}
if (this.min && this.value < this.min) {
return I18n.t("admin.customize.theme.schema.fields.number.too_small", {
return i18n("admin.customize.theme.schema.fields.number.too_small", {
count: this.min,
});
}
if (this.max && this.value > this.max) {
return I18n.t("admin.customize.theme.schema.fields.number.too_large", {
return i18n("admin.customize.theme.schema.fields.number.too_large", {
count: this.max,
});
}

View File

@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { isBlank } from "@ember/utils";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class SchemaThemeSettingTypeModels extends Component {
@tracked value = this.args.value;
@ -33,12 +33,9 @@ export default class SchemaThemeSettingTypeModels extends Component {
(this.min && this.value && this.value.length < this.min) ||
(this.required && isValueBlank)
) {
return I18n.t(
`admin.customize.theme.schema.fields.${this.type}.at_least`,
{
count: this.min || 1,
}
);
return i18n(`admin.customize.theme.schema.fields.${this.type}.at_least`, {
count: this.min || 1,
});
}
}
}

View File

@ -5,7 +5,7 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { and, not } from "truth-helpers";
import concatClass from "discourse/helpers/concat-class";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import FieldInputDescription from "admin/components/schema-theme-setting/field-input-description";
export default class SchemaThemeSettingTypeString extends Component {
@ -32,14 +32,14 @@ export default class SchemaThemeSettingTypeString extends Component {
if (valueLength === 0) {
if (this.required) {
return I18n.t("admin.customize.theme.schema.fields.required");
return i18n("admin.customize.theme.schema.fields.required");
} else {
return;
}
}
if (this.minLength && valueLength < this.minLength) {
return I18n.t("admin.customize.theme.schema.fields.string.too_short", {
return i18n("admin.customize.theme.schema.fields.string.too_short", {
count: this.minLength,
});
}

View File

@ -4,7 +4,7 @@ import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
import { classNames, tagName } from "@ember-decorators/component";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import ScreenedIpAddress from "admin/models/screened-ip-address";
/**
@ -30,22 +30,22 @@ export default class ScreenedIpAddressForm extends Component {
actionNames(adminAllowlistEnabled) {
if (adminAllowlistEnabled) {
return [
{ id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") },
{ id: "block", name: i18n("admin.logs.screened_ips.actions.block") },
{
id: "do_nothing",
name: I18n.t("admin.logs.screened_ips.actions.do_nothing"),
name: i18n("admin.logs.screened_ips.actions.do_nothing"),
},
{
id: "allow_admin",
name: I18n.t("admin.logs.screened_ips.actions.allow_admin"),
name: i18n("admin.logs.screened_ips.actions.allow_admin"),
},
];
} else {
return [
{ id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") },
{ id: "block", name: i18n("admin.logs.screened_ips.actions.block") },
{
id: "do_nothing",
name: I18n.t("admin.logs.screened_ips.actions.do_nothing"),
name: i18n("admin.logs.screened_ips.actions.do_nothing"),
},
];
}
@ -75,10 +75,10 @@ export default class ScreenedIpAddressForm extends Component {
.catch((e) => {
this.set("formSubmitted", false);
const message = e.jqXHR.responseJSON?.errors
? I18n.t("generic_error_with_reason", {
? i18n("generic_error_with_reason", {
error: e.jqXHR.responseJSON.errors.join(". "),
})
: I18n.t("generic_error");
: i18n("generic_error");
this.dialog.alert({
message,
didConfirm: () => this.focusInput(),

View File

@ -2,7 +2,7 @@ import Component from "@ember/component";
import { action, set } from "@ember/object";
import { isEmpty } from "@ember/utils";
import { classNameBindings } from "@ember-decorators/component";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
@classNameBindings(":value-list", ":secret-value-list")
export default class SecretValueList extends Component {
@ -59,7 +59,7 @@ export default class SecretValueList extends Component {
for (let input of inputs) {
if (isEmpty(input) || input.includes("|")) {
this.setValidationMessage(
I18n.t("admin.site_settings.secret_list.invalid_input")
i18n("admin.site_settings.secret_list.invalid_input")
);
return true;
}

View File

@ -5,9 +5,8 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import DButton from "discourse/components/d-button";
import i18n from "discourse-common/helpers/i18n";
import { makeArray } from "discourse-common/lib/helpers";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import ListSetting from "select-kit/components/list-setting";
const IMAGE_TYPES = [
@ -89,7 +88,7 @@ export default class FileTypesList extends Component {
this.toasts.success({
data: {
message: I18n.t("admin.site_settings.file_types_list.add_types_toast", {
message: i18n("admin.site_settings.file_types_list.add_types_toast", {
types: diffTypes.join(", "),
}),
},

View File

@ -6,7 +6,7 @@ import { service } from "@ember/service";
import concatClass from "discourse/helpers/concat-class";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
export default class TagsUploader extends Component {
@service dialog;

View File

@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class ThemeSettingsEditor extends Component {
@service dialog;
@ -100,7 +100,7 @@ export default class ThemeSettingsEditor extends Component {
this.errors = [
...this.errors,
{
setting: I18n.t("admin.customize.syntax_error"),
setting: i18n("admin.customize.syntax_error"),
errorMessage: e.message,
},
];
@ -112,8 +112,8 @@ export default class ThemeSettingsEditor extends Component {
this.errors = [
...this.errors,
{
setting: I18n.t("admin.customize.syntax_error"),
errorMessage: I18n.t("admin.customize.validation_settings_keys"),
setting: i18n("admin.customize.syntax_error"),
errorMessage: i18n("admin.customize.validation_settings_keys"),
},
];
this.saving = false;
@ -139,7 +139,7 @@ export default class ThemeSettingsEditor extends Component {
...this.errors,
{
setting: deletedNames.join(", "),
errorMessage: I18n.t("admin.customize.validation_settings_deleted"),
errorMessage: i18n("admin.customize.validation_settings_deleted"),
},
];
}
@ -149,7 +149,7 @@ export default class ThemeSettingsEditor extends Component {
...this.errors,
{
setting: addedNames.join(","),
errorMessage: I18n.t("admin.customize.validation_settings_added"),
errorMessage: i18n("admin.customize.validation_settings_added"),
},
];
}

View File

@ -4,7 +4,7 @@ import { action } from "@ember/object";
import { isEmpty } from "@ember/utils";
import { ajax } from "discourse/lib/ajax";
import { extractError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const THEME_FIELD_VARIABLE_TYPE_IDS = [2, 3, 4];
const SCSS_VARIABLE_NAMES = [
@ -66,9 +66,9 @@ export default class ThemeUploadAdd extends Component {
if (!this.name) {
return;
} else if (!this.name.match(/^[a-z_][a-z0-9_-]*$/i)) {
return I18n.t("admin.customize.theme.variable_name_error.invalid_syntax");
return i18n("admin.customize.theme.variable_name_error.invalid_syntax");
} else if (SCSS_VARIABLE_NAMES.includes(name.toLowerCase())) {
return I18n.t("admin.customize.theme.variable_name_error.no_overwrite");
return i18n("admin.customize.theme.variable_name_error.no_overwrite");
} else if (
this.args.model.themeFields.some(
(tf) =>
@ -76,7 +76,7 @@ export default class ThemeUploadAdd extends Component {
this.name === tf.name
)
) {
return I18n.t("admin.customize.theme.variable_name_error.must_be_unique");
return i18n("admin.customize.theme.variable_name_error.must_be_unique");
}
}

View File

@ -7,8 +7,7 @@ import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
import { popupAjaxError } from "discourse/lib/ajax-error";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import DMenu from "float-kit/components/d-menu";
import ThemesGridPlaceholder from "./themes-grid-placeholder";
@ -74,7 +73,7 @@ export default class ThemeCard extends Component {
this.toasts.success({
data: {
message: I18n.t("admin.customize.theme.set_default_success", {
message: i18n("admin.customize.theme.set_default_success", {
theme: this.args.theme.name,
}),
},
@ -94,7 +93,7 @@ export default class ThemeCard extends Component {
.then(() => {
this.toasts.success({
data: {
message: I18n.t("admin.customize.theme.update_success", {
message: i18n("admin.customize.theme.update_success", {
theme: this.args.theme.name,
}),
},

View File

@ -8,9 +8,9 @@ import { htmlSafe } from "@ember/template";
import PluginOutlet from "discourse/components/plugin-outlet";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import escape from "discourse-common/lib/escape";
import { iconHTML } from "discourse-common/lib/icon-library";
import { i18n } from "discourse-i18n";
const MAX_COMPONENTS = 4;

View File

@ -5,7 +5,7 @@ import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
import DeleteThemesConfirm from "discourse/components/modal/delete-themes-confirm";
import discourseComputed, { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import { COMPONENTS, THEMES } from "admin/models/theme";
const ALL_FILTER = "all";
@ -16,37 +16,37 @@ const DISABLED_FILTER = "disabled";
const UPDATES_AVAILABLE_FILTER = "updates_available";
const THEMES_FILTERS = [
{ name: I18n.t("admin.customize.theme.all_filter"), id: ALL_FILTER },
{ name: I18n.t("admin.customize.theme.active_filter"), id: ACTIVE_FILTER },
{ name: i18n("admin.customize.theme.all_filter"), id: ALL_FILTER },
{ name: i18n("admin.customize.theme.active_filter"), id: ACTIVE_FILTER },
{
name: I18n.t("admin.customize.theme.inactive_filter"),
name: i18n("admin.customize.theme.inactive_filter"),
id: INACTIVE_FILTER,
},
{
name: I18n.t("admin.customize.theme.updates_available_filter"),
name: i18n("admin.customize.theme.updates_available_filter"),
id: UPDATES_AVAILABLE_FILTER,
},
];
const COMPONENTS_FILTERS = [
{ name: I18n.t("admin.customize.component.all_filter"), id: ALL_FILTER },
{ name: i18n("admin.customize.component.all_filter"), id: ALL_FILTER },
{
name: I18n.t("admin.customize.component.used_filter"),
name: i18n("admin.customize.component.used_filter"),
id: ACTIVE_FILTER,
},
{
name: I18n.t("admin.customize.component.unused_filter"),
name: i18n("admin.customize.component.unused_filter"),
id: INACTIVE_FILTER,
},
{
name: I18n.t("admin.customize.component.enabled_filter"),
name: i18n("admin.customize.component.enabled_filter"),
id: ENABLED_FILTER,
},
{
name: I18n.t("admin.customize.component.disabled_filter"),
name: i18n("admin.customize.component.disabled_filter"),
id: DISABLED_FILTER,
},
{
name: I18n.t("admin.customize.component.updates_available_filter"),
name: i18n("admin.customize.component.updates_available_filter"),
id: UPDATES_AVAILABLE_FILTER,
},
];

View File

@ -3,7 +3,7 @@ import { getOwner } from "@ember/owner";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import { service } from "@ember/service";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
export default class UppyBackupUploader extends Component {
@service siteSettings;

View File

@ -7,7 +7,7 @@ import { classNames, tagName } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import WatchedWord from "admin/models/watched-word";
@tagName("form")
@ -84,7 +84,7 @@ export default class WatchedWordForm extends Component {
if (!this.isUniqueWord) {
this.setProperties({
showMessage: true,
message: I18n.t("admin.watched_words.form.exists"),
message: i18n("admin.watched_words.form.exists"),
});
return;
}
@ -111,7 +111,7 @@ export default class WatchedWordForm extends Component {
replacement: "",
selectedTags: [],
showMessage: true,
message: I18n.t("admin.watched_words.form.success"),
message: i18n("admin.watched_words.form.success"),
isCaseSensitive: false,
isHtml: false,
});

View File

@ -4,7 +4,7 @@ import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
@classNames("watched-words-uploader")
export default class WatchedWordUploader extends Component {
@ -20,7 +20,7 @@ export default class WatchedWordUploader extends Component {
},
perFileData: () => ({ action_key: this.actionKey }),
uploadDone: () => {
this.dialog.alert(I18n.t("admin.watched_words.form.upload_successful"));
this.dialog.alert(i18n("admin.watched_words.form.upload_successful"));
this.done();
},
});

View File

@ -1,9 +1,9 @@
import Component from "@glimmer/component";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class WebhookEventChooser extends Component {
get details() {
return I18n.t(
return i18n(
`admin.web_hooks.${this.args.group}_event.${this.args.type.name}`
);
}

View File

@ -5,7 +5,7 @@ import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ensureJSON, plainJSON, prettyJSON } from "discourse/lib/formatter";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class WebhookEvent extends Component {
@service dialog;
@ -37,7 +37,7 @@ export default class WebhookEvent extends Component {
get completion() {
const seconds = Math.floor(this.args.event.duration / 10.0) / 100.0;
return I18n.t("admin.web_hooks.events.completed_in", { count: seconds });
return i18n("admin.web_hooks.events.completed_in", { count: seconds });
}
get expandRequestIcon() {
@ -55,7 +55,7 @@ export default class WebhookEvent extends Component {
@action
redeliver() {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.web_hooks.events.redeliver_confirm"),
message: i18n("admin.web_hooks.events.redeliver_confirm"),
didConfirm: async () => {
try {
const json = await ajax(
@ -82,7 +82,7 @@ export default class WebhookEvent extends Component {
this.headers = plainJSON(headers);
this.body = prettyJSON(this.args.event.payload);
this.expandDetails = this.expandDetailsRequestKey;
this.bodyLabel = I18n.t("admin.web_hooks.events.payload");
this.bodyLabel = i18n("admin.web_hooks.events.payload");
} else {
this.expandDetails = null;
}
@ -94,7 +94,7 @@ export default class WebhookEvent extends Component {
this.headers = plainJSON(this.args.event.response_headers);
this.body = this.args.event.response_body;
this.expandDetails = this.expandDetailsResponseKey;
this.bodyLabel = I18n.t("admin.web_hooks.events.body");
this.bodyLabel = i18n("admin.web_hooks.events.body");
} else {
this.expandDetails = null;
}

View File

@ -6,7 +6,7 @@ import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bind } from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class WebhookEvents extends Component {
@service messageBus;
@ -56,11 +56,11 @@ export default class WebhookEvents extends Component {
return [
{
id: "successful",
name: I18n.t("admin.web_hooks.events.filter_status.successful"),
name: i18n("admin.web_hooks.events.filter_status.successful"),
},
{
id: "failed",
name: I18n.t("admin.web_hooks.events.filter_status.failed"),
name: i18n("admin.web_hooks.events.filter_status.failed"),
},
];
}
@ -152,15 +152,13 @@ export default class WebhookEvents extends Component {
@action
async redeliverFailed() {
if (!this.failedEventIds.length) {
this.dialog.alert(
I18n.t("admin.web_hooks.events.no_events_to_redeliver")
);
this.dialog.alert(i18n("admin.web_hooks.events.no_events_to_redeliver"));
this.redeliverEnabled = false;
return;
}
return this.dialog.yesNoConfirm({
message: I18n.t("admin.web_hooks.events.redeliver_failed_confirm", {
message: i18n("admin.web_hooks.events.redeliver_failed_confirm", {
count: this.failedEventIds.length,
}),
didConfirm: async () => {
@ -176,7 +174,7 @@ export default class WebhookEvents extends Component {
});
} else {
this.dialog.alert(
I18n.t("admin.web_hooks.events.no_events_to_redeliver")
i18n("admin.web_hooks.events.no_events_to_redeliver")
);
}
} catch (error) {

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import icon from "discourse-common/helpers/d-icon";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class WebhookStatus extends Component {
iconNames = ["far-circle", "circle-xmark", "circle", "circle"];
@ -12,7 +12,7 @@ export default class WebhookStatus extends Component {
}
get deliveryStatus() {
return I18n.t(`admin.web_hooks.delivery_status.${this.status.name}`);
return i18n(`admin.web_hooks.delivery_status.${this.status.name}`);
}
get iconName() {

View File

@ -6,7 +6,7 @@ import { isBlank } from "@ember/utils";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import ApiKeyUrlsModal from "../components/modal/api-key-urls";
export default class AdminApiKeysNewController extends Controller {
@ -14,13 +14,13 @@ export default class AdminApiKeysNewController extends Controller {
@service modal;
userModes = [
{ id: "all", name: I18n.t("admin.api.all_users") },
{ id: "single", name: I18n.t("admin.api.single_user") },
{ id: "all", name: i18n("admin.api.all_users") },
{ id: "single", name: i18n("admin.api.single_user") },
];
scopeModes = [
{ id: "granular", name: I18n.t("admin.api.scopes.granular") },
{ id: "read_only", name: I18n.t("admin.api.scopes.read_only") },
{ id: "global", name: I18n.t("admin.api.scopes.global") },
{ id: "granular", name: i18n("admin.api.scopes.granular") },
{ id: "read_only", name: i18n("admin.api.scopes.read_only") },
{ id: "global", name: i18n("admin.api.scopes.global") },
];
globalScopes = null;
scopes = null;

View File

@ -4,17 +4,17 @@ import { alias, equal } from "@ember/object/computed";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n, setting } from "discourse/lib/computed";
import { computedI18n, setting } from "discourse/lib/computed";
import getURL from "discourse-common/lib/get-url";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminBackupsIndexController extends Controller {
@service dialog;
@controller adminBackups;
@alias("adminBackups.model") status;
@i18n("admin.backups.upload.label") uploadLabel;
@computedI18n("admin.backups.upload.label") uploadLabel;
@setting("backup_location") backupLocation;
@equal("backupLocation", "local") localBackupStorage;
@ -37,7 +37,7 @@ export default class AdminBackupsIndexController extends Controller {
async download(backup) {
try {
await ajax(`/admin/backups/${backup.filename}`, { type: "PUT" });
this.dialog.alert(I18n.t("admin.backups.operations.download.alert"));
this.dialog.alert(i18n("admin.backups.operations.download.alert"));
} catch (err) {
popupAjaxError(err);
}

View File

@ -4,7 +4,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { extractError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminBadgesAwardController extends Controller {
@service dialog;
@ -69,7 +69,7 @@ export default class AdminBadgesAwardController extends Controller {
unmatched_entries: unmatchedEntries,
unmatched_entries_count: unmatchedEntriesCount,
}) => {
this.resultsMessage = I18n.t("admin.badges.mass_award.success", {
this.resultsMessage = i18n("admin.badges.mass_award.success", {
count: matchedCount,
});
this.success = true;
@ -85,7 +85,7 @@ export default class AdminBadgesAwardController extends Controller {
})
.finally(() => (this.saving = false));
} else {
this.dialog.alert(I18n.t("admin.badges.mass_award.aborted"));
this.dialog.alert(i18n("admin.badges.mass_award.aborted"));
}
}
}

View File

@ -6,7 +6,7 @@ import { isNone } from "@ember/utils";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import getURL from "discourse-common/lib/get-url";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import BadgePreviewModal from "../../components/modal/badge-preview";
const FORM_FIELDS = [
@ -136,11 +136,11 @@ export default class AdminBadgesShowController extends Controller {
if (!data.icon && !data.image_url) {
addError("icon", {
title: "Icon",
message: I18n.t("admin.badges.icon_or_image"),
message: i18n("admin.badges.icon_or_image"),
});
addError("image_url", {
title: "Image",
message: I18n.t("admin.badges.icon_or_image"),
message: i18n("admin.badges.icon_or_image"),
});
} else {
removeError("image_url");
@ -191,7 +191,7 @@ export default class AdminBadgesShowController extends Controller {
try {
this.model = await this.model.save(data);
this.toasts.success({ data: { message: I18n.t("saved") } });
this.toasts.success({ data: { message: i18n("saved") } });
if (newBadge) {
const adminBadges = this.get("adminBadges.model");
@ -217,7 +217,7 @@ export default class AdminBadgesShowController extends Controller {
}
return this.dialog.yesNoConfirm({
message: I18n.t("admin.badges.delete_confirm"),
message: i18n("admin.badges.delete_confirm"),
didConfirm: async () => {
try {
await this.formApi.reset();
@ -225,7 +225,7 @@ export default class AdminBadgesShowController extends Controller {
this.adminBadges.model.removeObject(this.model);
this.router.transitionTo("adminBadges.index");
} catch {
this.dialog.alert(I18n.t("generic_error"));
this.dialog.alert(i18n("generic_error"));
}
},
});

View File

@ -3,7 +3,7 @@ import { action, computed } from "@ember/object";
import { service } from "@ember/service";
import { clipboardCopy } from "discourse/lib/utilities";
import discourseLater from "discourse-common/lib/later";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminCustomizeColorsShowController extends Controller {
@service dialog;
@ -34,12 +34,12 @@ export default class AdminCustomizeColorsShowController extends Controller {
if (clipboardCopy(this.model.schemeJson())) {
this.set(
"model.savingStatus",
I18n.t("admin.customize.copied_to_clipboard")
i18n("admin.customize.copied_to_clipboard")
);
} else {
this.set(
"model.savingStatus",
I18n.t("admin.customize.copy_to_clipboard_error")
i18n("admin.customize.copy_to_clipboard_error")
);
}
@ -53,7 +53,7 @@ export default class AdminCustomizeColorsShowController extends Controller {
const newColorScheme = this.model.copy();
newColorScheme.set(
"name",
I18n.t("admin.customize.colors.copy_name_prefix") +
i18n("admin.customize.colors.copy_name_prefix") +
" " +
this.get("model.name")
);
@ -76,7 +76,7 @@ export default class AdminCustomizeColorsShowController extends Controller {
@action
destroy() {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.customize.colors.delete_confirm"),
message: i18n("admin.customize.colors.delete_confirm"),
didConfirm: () => {
return this.model.destroy().then(() => {
this.allColors.removeObject(this.model);

View File

@ -2,7 +2,7 @@ import Controller from "@ember/controller";
import EmberObject, { action } from "@ember/object";
import { service } from "@ember/service";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import ColorSchemeSelectBaseModal from "admin/components/modal/color-scheme-select-base";
export default class AdminCustomizeColorsController extends Controller {
@ -33,7 +33,7 @@ export default class AdminCustomizeColorsController extends Controller {
const base = this.baseColorSchemes.findBy("base_scheme_id", baseKey);
const newColorScheme = base.copy();
newColorScheme.setProperties({
name: I18n.t("admin.customize.colors.new_name"),
name: i18n("admin.customize.colors.new_name"),
base_scheme_id: base.get("base_scheme_id"),
});
newColorScheme.save().then(() => {

View File

@ -2,14 +2,14 @@ import Controller from "@ember/controller";
import { action } from "@ember/object";
import { service } from "@ember/service";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminCustomizeEmailStyleEditController extends Controller {
@service dialog;
@discourseComputed("model.isSaving")
saveButtonText(isSaving) {
return isSaving ? I18n.t("saving") : I18n.t("admin.customize.save");
return isSaving ? i18n("saving") : i18n("admin.customize.save");
}
@discourseComputed("model.changed", "model.isSaving")
@ -26,10 +26,10 @@ export default class AdminCustomizeEmailStyleEditController extends Controller {
.catch((e) => {
const msg =
e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors
? I18n.t("admin.customize.email_style.save_error_with_reason", {
? i18n("admin.customize.email_style.save_error_with_reason", {
error: e.jqXHR.responseJSON.errors.join(". "),
})
: I18n.t("generic_error");
: i18n("generic_error");
this.dialog.alert(msg);
})
.finally(() => this.set("model.changed", false));

View File

@ -4,7 +4,7 @@ import { service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminCustomizeEmailTemplatesEditController extends Controller.extend(
bufferedProperty("emailTemplate")
@ -48,7 +48,7 @@ export default class AdminCustomizeEmailTemplatesEditController extends Controll
this.set("saved", false);
this.dialog.yesNoConfirm({
title: I18n.t("admin.customize.email_templates.revert_confirm"),
title: i18n("admin.customize.email_templates.revert_confirm"),
didConfirm: () => {
return this.emailTemplate
.revert()

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { url } from "discourse/lib/computed";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminCustomizeThemesEditController extends Controller {
@service router;
@ -33,7 +33,7 @@ export default class AdminCustomizeThemesEditController extends Controller {
@discourseComputed("model.isSaving")
saveButtonText(isSaving) {
return isSaving ? I18n.t("saving") : I18n.t("admin.customize.save");
return isSaving ? i18n("saving") : i18n("admin.customize.save");
}
@discourseComputed("model.changed", "model.isSaving")

View File

@ -14,7 +14,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { url } from "discourse/lib/computed";
import { makeArray } from "discourse-common/lib/helpers";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import ThemeSettingsEditor from "admin/components/theme-settings-editor";
import { COMPONENTS, THEMES } from "admin/models/theme";
import ThemeSettings from "admin/models/theme-settings";
@ -63,9 +63,9 @@ export default class AdminCustomizeThemesShowController extends Controller {
if (fields.length < 1) {
return;
}
let resultString = I18n.t("admin.customize.theme." + target);
let resultString = i18n("admin.customize.theme." + target);
const formattedFields = fields
.map((f) => I18n.t("admin.customize.theme." + f.name + ".text"))
.map((f) => i18n("admin.customize.theme." + f.name + ".text"))
.join(" , ");
resultString += `: ${formattedFields}`;
descriptions.push(resultString);
@ -97,13 +97,13 @@ export default class AdminCustomizeThemesShowController extends Controller {
preview: null,
anyValue: false,
setting: "parent_theme_ids",
label: I18n.t("admin.customize.theme.component_on_themes"),
label: i18n("admin.customize.theme.component_on_themes"),
choices: this.availableThemesNames,
default: this.parentThemesNames.join("|"),
value: this.parentThemesNames.join("|"),
defaultValues: this.availableActiveThemesNames.join("|"),
allThemes: this.allThemes,
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes"),
setDefaultValuesLabel: i18n("admin.customize.theme.add_all_themes"),
});
}
@ -115,13 +115,13 @@ export default class AdminCustomizeThemesShowController extends Controller {
preview: null,
anyValue: false,
setting: "child_theme_ids",
label: I18n.t("admin.customize.theme.included_components"),
label: i18n("admin.customize.theme.included_components"),
choices: this.availableComponentsNames,
default: this.childThemesNames.join("|"),
value: this.childThemesNames.join("|"),
defaultValues: this.availableActiveComponentsNames.join("|"),
allThemes: this.allThemes,
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all"),
setDefaultValuesLabel: i18n("admin.customize.theme.add_all"),
});
}
@ -354,7 +354,7 @@ export default class AdminCustomizeThemesShowController extends Controller {
editTheme() {
if (this.get("model.remote_theme.is_git")) {
this.dialog.confirm({
message: I18n.t("admin.customize.theme.edit_confirm"),
message: i18n("admin.customize.theme.edit_confirm"),
didConfirm: () => this.transitionToEditRoute(),
});
} else {
@ -396,7 +396,7 @@ export default class AdminCustomizeThemesShowController extends Controller {
@action
removeUpload(upload) {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.customize.theme.delete_upload_confirm"),
message: i18n("admin.customize.theme.delete_upload_confirm"),
didConfirm: () => this.model.removeField(upload),
});
}
@ -409,7 +409,7 @@ export default class AdminCustomizeThemesShowController extends Controller {
@action
destroyTheme() {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.customize.delete_confirm", {
message: i18n("admin.customize.delete_confirm", {
theme_name: this.get("model.name"),
}),
didConfirm: () => {
@ -439,10 +439,10 @@ export default class AdminCustomizeThemesShowController extends Controller {
? this.get("model.parentThemes")
: this.get("model.childThemes");
let message = I18n.t(`${this.convertKey}_alert_generic`);
let message = i18n(`${this.convertKey}_alert_generic`);
if (relatives && relatives.length > 0) {
message = I18n.t(`${this.convertKey}_alert`, {
message = i18n(`${this.convertKey}_alert`, {
relatives: relatives.map((relative) => relative.get("name")).join(", "),
});
}

View File

@ -5,7 +5,7 @@ import { setting } from "discourse/lib/computed";
import getURL from "discourse-common/lib/get-url";
import { makeArray } from "discourse-common/lib/helpers";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminDashboard from "admin/models/admin-dashboard";
import Report from "admin/models/report";
import AdminDashboardTabController from "./admin-dashboard-tab";
@ -134,7 +134,7 @@ export default class AdminDashboardGeneralController extends AdminDashboardTabCo
@discourseComputed
trendingSearchDisabledLabel() {
return I18n.t("admin.dashboard.reports.trending_search.disabled", {
return i18n("admin.dashboard.reports.trending_search.disabled", {
basePath: getURL(""),
});
}

View File

@ -6,7 +6,7 @@ import { htmlSafe } from "@ember/template";
import { observes } from "@ember-decorators/object";
import { ajax } from "discourse/lib/ajax";
import { escapeExpression } from "discourse/lib/utilities";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminEmailIndexController extends Controller {
@service dialog;
@ -51,13 +51,13 @@ export default class AdminEmailIndexController extends Controller {
if (e.jqXHR.responseJSON?.errors) {
this.dialog.alert({
message: htmlSafe(
I18n.t("admin.email.error", {
i18n("admin.email.error", {
server_error: escapeExpression(e.jqXHR.responseJSON.errors[0]),
})
),
});
} else {
this.dialog.alert({ message: I18n.t("admin.email.test_error") });
this.dialog.alert({ message: i18n("admin.email.test_error") });
}
})
.finally(() => this.set("sendingEmail", false));

View File

@ -6,7 +6,7 @@ import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import ScreenedIpAddress from "admin/models/screened-ip-address";
export default class AdminLogsScreenedIpAddressesController extends Controller {
@ -68,12 +68,12 @@ export default class AdminLogsScreenedIpAddressesController extends Controller {
.catch((e) => {
if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) {
this.dialog.alert(
I18n.t("generic_error_with_reason", {
i18n("generic_error_with_reason", {
error: e.jqXHR.responseJSON.errors.join(". "),
})
);
} else {
this.dialog.alert(I18n.t("generic_error"));
this.dialog.alert(i18n("generic_error"));
}
if (wasEditing) {
record.set("editing", true);
@ -84,7 +84,7 @@ export default class AdminLogsScreenedIpAddressesController extends Controller {
@action
destroyRecord(record) {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.logs.screened_ips.delete_confirm", {
message: i18n("admin.logs.screened_ips.delete_confirm", {
ip_address: record.get("ip_address"),
}),
didConfirm: () => {
@ -94,12 +94,12 @@ export default class AdminLogsScreenedIpAddressesController extends Controller {
if (deleted) {
this.model.removeObject(record);
} else {
this.dialog.alert(I18n.t("generic_error"));
this.dialog.alert(i18n("generic_error"));
}
})
.catch((e) => {
this.dialog.alert(
I18n.t("generic_error_with_reason", {
i18n("generic_error_with_reason", {
error: `http: ${e.status} - ${e.body}`,
})
);

View File

@ -5,7 +5,7 @@ import { service } from "@ember/service";
import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminStaffActionLogComponent from "../components/modal/staff-action-log-change";
import StaffActionLogDetailsModal from "../components/modal/staff-action-log-details";
@ -20,7 +20,7 @@ export default class AdminLogsStaffActionLogsController extends Controller {
@discourseComputed("filters.action_name")
actionFilter(name) {
return name ? I18n.t("admin.logs.staff_actions.actions." + name) : null;
return name ? i18n("admin.logs.staff_actions.actions." + name) : null;
}
@discourseComputed("filters")
@ -39,7 +39,7 @@ export default class AdminLogsStaffActionLogsController extends Controller {
.map((historyAction) => ({
id: historyAction.id,
action_id: historyAction.action_id,
name: I18n.t(
name: i18n(
"admin.logs.staff_actions.actions." + historyAction.id
),
name_raw: historyAction.id,

View File

@ -6,7 +6,7 @@ import { observes } from "@ember-decorators/object";
import { clipboardCopy } from "discourse/lib/utilities";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import Permalink from "admin/models/permalink";
export default class AdminPermalinksIndexController extends Controller {
@ -37,7 +37,7 @@ export default class AdminPermalinksIndexController extends Controller {
this.toasts.success({
duration: 3000,
data: {
message: I18n.t("admin.permalink.copy_success"),
message: i18n("admin.permalink.copy_success"),
},
});
}
@ -45,13 +45,13 @@ export default class AdminPermalinksIndexController extends Controller {
@action
destroyRecord(permalink) {
this.dialog.yesNoConfirm({
message: I18n.t("admin.permalink.delete_confirm"),
message: i18n("admin.permalink.delete_confirm"),
didConfirm: async () => {
try {
await this.store.destroyRecord("permalink", permalink);
this.model.removeObject(permalink);
} catch {
this.dialog.alert(I18n.t("generic_error"));
this.dialog.alert(i18n("generic_error"));
}
},
});

View File

@ -1,5 +1,5 @@
import Controller from "@ember/controller";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export const DEFAULT_PERIOD = "yearly";
export default class AdminSearchLogsIndexController extends Controller {
@ -9,12 +9,12 @@ export default class AdminSearchLogsIndexController extends Controller {
searchTypeOptions = [
{
id: "all",
name: I18n.t("admin.logs.search_logs.types.all_search_types"),
name: i18n("admin.logs.search_logs.types.all_search_types"),
},
{ id: "header", name: I18n.t("admin.logs.search_logs.types.header") },
{ id: "header", name: i18n("admin.logs.search_logs.types.header") },
{
id: "full_page",
name: I18n.t("admin.logs.search_logs.types.full_page"),
name: i18n("admin.logs.search_logs.types.full_page"),
},
];
}

View File

@ -1,5 +1,5 @@
import Controller from "@ember/controller";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import { DEFAULT_PERIOD } from "admin/controllers/admin-search-logs-index";
export default class AdminSearchLogsTermController extends Controller {
@ -10,16 +10,16 @@ export default class AdminSearchLogsTermController extends Controller {
searchTypeOptions = [
{
id: "all",
name: I18n.t("admin.logs.search_logs.types.all_search_types"),
name: i18n("admin.logs.search_logs.types.all_search_types"),
},
{ id: "header", name: I18n.t("admin.logs.search_logs.types.header") },
{ id: "header", name: i18n("admin.logs.search_logs.types.header") },
{
id: "full_page",
name: I18n.t("admin.logs.search_logs.types.full_page"),
name: i18n("admin.logs.search_logs.types.full_page"),
},
{
id: "click_through_only",
name: I18n.t("admin.logs.search_logs.types.click_through_only"),
name: i18n("admin.logs.search_logs.types.click_through_only"),
},
];

View File

@ -4,7 +4,7 @@ import { service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class AdminSiteTextEdit extends Controller.extend(
bufferedProperty("siteText")
@ -43,7 +43,7 @@ export default class AdminSiteTextEdit extends Controller.extend(
this.set("saved", false);
this.dialog.yesNoConfirm({
message: I18n.t("admin.site_text.revert_confirm"),
message: i18n("admin.site_text.revert_confirm"),
didConfirm: () => {
this.siteText
.revert(this.locale)

View File

@ -7,7 +7,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { grantableBadges } from "discourse/lib/grant-badge-utils";
import UserBadge from "discourse/models/user-badge";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminUser from "admin/models/admin-user";
export default class AdminUserBadgesController extends Controller {
@ -105,7 +105,7 @@ export default class AdminUserBadgesController extends Controller {
@action
revokeBadge(userBadge) {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.badges.revoke_confirm"),
message: i18n("admin.badges.revoke_confirm"),
didConfirm: () => {
return userBadge.revoke().then(() => {
this.model.removeObject(userBadge);

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { gte, sort } from "@ember/object/computed";
import { service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const MAX_FIELDS = 30;
@ -65,7 +65,7 @@ export default class AdminUserFieldsController extends Controller {
// Only confirm if we already been saved
if (f.get("id")) {
this.dialog.yesNoConfirm({
message: I18n.t("admin.user_fields.delete_confirm"),
message: i18n("admin.user_fields.delete_confirm"),
didConfirm: () => {
return f
.destroyRecord()

View File

@ -10,7 +10,7 @@ import DiscourseURL, { userPath } from "discourse/lib/url";
import CanCheckEmails from "discourse/mixins/can-check-emails";
import getURL from "discourse-common/lib/get-url";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminUser from "admin/models/admin-user";
import DeletePostsConfirmationModal from "../components/modal/delete-posts-confirmation";
import DeleteUserPostsProgressModal from "../components/modal/delete-user-posts-progress";
@ -98,14 +98,14 @@ export default class AdminUserIndexController extends Controller.extend(
}
if (staff) {
return I18n.t("admin.user.delete_posts_forbidden_because_staff");
return i18n("admin.user.delete_posts_forbidden_because_staff");
}
if (postCount > this.siteSettings.delete_all_posts_max) {
return I18n.t("admin.user.cant_delete_all_too_many_posts", {
return i18n("admin.user.cant_delete_all_too_many_posts", {
count: this.siteSettings.delete_all_posts_max,
});
} else {
return I18n.t("admin.user.cant_delete_all_posts", {
return i18n("admin.user.cant_delete_all_posts", {
count: this.siteSettings.delete_user_max_post_age,
});
}
@ -118,9 +118,9 @@ export default class AdminUserIndexController extends Controller.extend(
}
if (staff) {
return I18n.t("admin.user.delete_forbidden_because_staff");
return i18n("admin.user.delete_forbidden_because_staff");
} else {
return I18n.t("admin.user.delete_forbidden", {
return i18n("admin.user.delete_forbidden", {
count: this.siteSettings.delete_user_max_post_age,
});
}
@ -134,7 +134,7 @@ export default class AdminUserIndexController extends Controller.extend(
groupAdded(added) {
this.model
.groupAdded(added)
.catch(() => this.dialog.alert(I18n.t("generic_error")));
.catch(() => this.dialog.alert(i18n("generic_error")));
}
groupRemoved(groupId) {
@ -145,7 +145,7 @@ export default class AdminUserIndexController extends Controller.extend(
this.set("originalPrimaryGroupId", null);
}
})
.catch(() => this.dialog.alert(I18n.t("generic_error")));
.catch(() => this.dialog.alert(i18n("generic_error")));
}
@discourseComputed("ssoLastPayload")
@ -160,9 +160,9 @@ export default class AdminUserIndexController extends Controller.extend(
.then(() => DiscourseURL.redirectTo("/"))
.catch((e) => {
if (e.status === 404) {
this.dialog.alert(I18n.t("admin.impersonate.not_found"));
this.dialog.alert(i18n("admin.impersonate.not_found"));
} else {
this.dialog.alert(I18n.t("admin.impersonate.invalid"));
this.dialog.alert(i18n("admin.impersonate.invalid"));
}
});
}
@ -171,7 +171,7 @@ export default class AdminUserIndexController extends Controller.extend(
logOut() {
return this.model
.logOut()
.then(() => this.dialog.alert(I18n.t("admin.user.logged_out")));
.then(() => this.dialog.alert(i18n("admin.user.logged_out")));
}
@action
@ -197,7 +197,7 @@ export default class AdminUserIndexController extends Controller.extend(
this.model.setProperties({ active: false, can_activate: true })
)
.catch((e) => {
const error = I18n.t("admin.user.deactivate_failed", {
const error = i18n("admin.user.deactivate_failed", {
error: this._formatError(e),
});
this.dialog.alert(error);
@ -208,7 +208,7 @@ export default class AdminUserIndexController extends Controller.extend(
sendActivationEmail() {
return this.model
.sendActivationEmail()
.then(() => this.dialog.alert(I18n.t("admin.user.activation_email_sent")))
.then(() => this.dialog.alert(i18n("admin.user.activation_email_sent")))
.catch(popupAjaxError);
}
@ -223,7 +223,7 @@ export default class AdminUserIndexController extends Controller.extend(
})
)
.catch((e) => {
const error = I18n.t("admin.user.activate_failed", {
const error = i18n("admin.user.activate_failed", {
error: this._formatError(e),
});
this.dialog.alert(error);
@ -241,7 +241,7 @@ export default class AdminUserIndexController extends Controller.extend(
.grantAdmin()
.then((result) => {
if (result.email_confirmation_required) {
this.dialog.alert(I18n.t("admin.user.grant_admin_confirm"));
this.dialog.alert(i18n("admin.user.grant_admin_confirm"));
}
})
.catch((error) => {
@ -278,7 +278,7 @@ export default class AdminUserIndexController extends Controller.extend(
}
error =
error ||
I18n.t("admin.user.trust_level_change_failed", {
i18n("admin.user.trust_level_change_failed", {
error: this._formatError(e),
});
this.dialog.alert(error);
@ -302,7 +302,7 @@ export default class AdminUserIndexController extends Controller.extend(
}
error =
error ||
I18n.t("admin.user.trust_level_change_failed", {
i18n("admin.user.trust_level_change_failed", {
error: this._formatError(e),
});
this.dialog.alert(error);
@ -322,7 +322,7 @@ export default class AdminUserIndexController extends Controller.extend(
@action
deleteAssociatedAccounts() {
this.dialog.yesNoConfirm({
message: I18n.t("admin.user.delete_associated_accounts_confirm"),
message: i18n("admin.user.delete_associated_accounts_confirm"),
didConfirm: () => {
this.model.deleteAssociatedAccounts().catch(popupAjaxError);
},
@ -346,27 +346,27 @@ export default class AdminUserIndexController extends Controller.extend(
document.location = getURL("/admin/users/list/active");
}
} else {
this.dialog.alert(I18n.t("admin.user.anonymize_failed"));
this.dialog.alert(i18n("admin.user.anonymize_failed"));
if (data.user) {
user.setProperties(data.user);
}
}
})
.catch(() => this.dialog.alert(I18n.t("admin.user.anonymize_failed")));
.catch(() => this.dialog.alert(i18n("admin.user.anonymize_failed")));
};
this.dialog.alert({
message: I18n.t("admin.user.anonymize_confirm"),
message: i18n("admin.user.anonymize_confirm"),
class: "delete-user-modal",
buttons: [
{
icon: "triangle-exclamation",
label: I18n.t("admin.user.anonymize_yes"),
label: i18n("admin.user.anonymize_yes"),
class: "btn-danger",
action: () => performAnonymize(),
},
{
label: I18n.t("composer.cancel"),
label: i18n("composer.cancel"),
},
],
});
@ -375,7 +375,7 @@ export default class AdminUserIndexController extends Controller.extend(
@action
disableSecondFactor() {
this.dialog.yesNoConfirm({
message: I18n.t("admin.user.disable_second_factor_confirm"),
message: i18n("admin.user.disable_second_factor_confirm"),
didConfirm: () => {
return this.model.disableSecondFactor();
},
@ -399,7 +399,7 @@ export default class AdminUserIndexController extends Controller.extend(
const location = document.location.pathname;
const performDestroy = (block) => {
this.dialog.notice(I18n.t("admin.user.deleting_user"));
this.dialog.notice(i18n("admin.user.deleting_user"));
let formData = { context: location };
if (block) {
formData["block_email"] = true;
@ -419,21 +419,21 @@ export default class AdminUserIndexController extends Controller.extend(
document.location = getURL("/admin/users/list/active");
}
} else {
this.dialog.alert(I18n.t("admin.user.delete_failed"));
this.dialog.alert(i18n("admin.user.delete_failed"));
}
})
.catch(() => {
this.dialog.alert(I18n.t("admin.user.delete_failed"));
this.dialog.alert(i18n("admin.user.delete_failed"));
});
};
this.dialog.alert({
title: I18n.t("admin.user.delete_confirm_title"),
message: I18n.t("admin.user.delete_confirm"),
title: i18n("admin.user.delete_confirm_title"),
message: i18n("admin.user.delete_confirm"),
class: "delete-user-modal",
buttons: [
{
label: I18n.t("admin.user.delete_dont_block"),
label: i18n("admin.user.delete_dont_block"),
class: "btn-primary",
action: () => {
return performDestroy(false);
@ -441,14 +441,14 @@ export default class AdminUserIndexController extends Controller.extend(
},
{
icon: "triangle-exclamation",
label: I18n.t("admin.user.delete_and_block"),
label: i18n("admin.user.delete_and_block"),
class: "btn-danger",
action: () => {
return performDestroy(true);
},
},
{
label: I18n.t("composer.cancel"),
label: i18n("composer.cancel"),
},
],
});
@ -492,12 +492,12 @@ export default class AdminUserIndexController extends Controller.extend(
if (response.success) {
this.modal.show(MergeUsersProgressModal);
} else {
this.dialog.alert(I18n.t("admin.user.merge_failed"));
this.dialog.alert(i18n("admin.user.merge_failed"));
}
})
.catch(() => {
AdminUser.find(user.id).then((u) => user.setProperties(u));
this.dialog.alert(I18n.t("admin.user.merge_failed"));
this.dialog.alert(i18n("admin.user.merge_failed"));
});
}
@ -598,7 +598,7 @@ export default class AdminUserIndexController extends Controller.extend(
data: { primary_group_id: primaryGroupId },
})
.then(() => this.set("originalPrimaryGroupId", primaryGroupId))
.catch(() => this.dialog.alert(I18n.t("generic_error")));
.catch(() => this.dialog.alert(i18n("generic_error")));
}
@action
@ -609,7 +609,7 @@ export default class AdminUserIndexController extends Controller.extend(
@action
deleteSSORecord() {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.user.discourse_connect.confirm_delete"),
message: i18n("admin.user.discourse_connect.confirm_delete"),
didConfirm: () => this.model.deleteSSORecord(),
});
}

View File

@ -1,12 +1,12 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { observes } from "@ember-decorators/object";
import { i18n } from "discourse/lib/computed";
import { computedI18n } from "discourse/lib/computed";
import CanCheckEmails from "discourse/mixins/can-check-emails";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import AdminUser from "admin/models/admin-user";
export default class AdminUsersListShowController extends Controller.extend(
@ -21,7 +21,7 @@ export default class AdminUsersListShowController extends Controller.extend(
listFilter = null;
selectAll = false;
@i18n("search_hint") searchHint;
@computedI18n("search_hint") searchHint;
_page = 1;
_results = [];
@ -29,7 +29,7 @@ export default class AdminUsersListShowController extends Controller.extend(
@discourseComputed("query")
title(query) {
return I18n.t("admin.users.titles." + query);
return i18n("admin.users.titles." + query);
}
@discourseComputed("showEmails")

Some files were not shown because too many files have changed in this diff Show More