mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
This commit is contained in:
@ -4,7 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
||||
@ -72,7 +72,7 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
||||
|
||||
assert.strictEqual(
|
||||
query(".chat-channel-card__members").textContent.trim(),
|
||||
I18n.t("chat.channel.memberships_count", { count: 4 })
|
||||
i18n("chat.channel.memberships_count", { count: 4 })
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
|
||||
@ -35,7 +35,7 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".chat-channel-leave-btn")
|
||||
.hasAttribute("title", I18n.t("chat.direct_messages.leave"));
|
||||
.hasAttribute("title", i18n("chat.direct_messages.leave"));
|
||||
});
|
||||
|
||||
test("has a specific title for message channel", async function (assert) {
|
||||
@ -45,7 +45,7 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".chat-channel-leave-btn")
|
||||
.hasAttribute("title", I18n.t("chat.leave"));
|
||||
.hasAttribute("title", i18n("chat.leave"));
|
||||
});
|
||||
|
||||
test("is not visible on mobile", async function (assert) {
|
||||
|
@ -3,7 +3,7 @@ import { render } from "@ember/test-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import {
|
||||
CHANNEL_STATUSES,
|
||||
@ -30,7 +30,7 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".chat-channel-status")
|
||||
.hasText(I18n.t("chat.channel_status.closed_header"));
|
||||
.hasText(i18n("chat.channel_status.closed_header"));
|
||||
});
|
||||
|
||||
test("accepts a format argument", async function (assert) {
|
||||
@ -44,7 +44,7 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".chat-channel-status")
|
||||
.hasText(I18n.t("chat.channel_status.archived"));
|
||||
.hasText(i18n("chat.channel_status.archived"));
|
||||
});
|
||||
|
||||
test("renders the correct icon", async function (assert) {
|
||||
|
@ -4,7 +4,7 @@ import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
||||
|
||||
module(
|
||||
@ -74,7 +74,7 @@ module(
|
||||
|
||||
assert.strictEqual(
|
||||
query(".chat-composer__input").placeholder,
|
||||
I18n.t("chat.placeholder_group")
|
||||
i18n("chat.placeholder_group")
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { click, render } from "@ember/test-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
|
||||
module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@ -17,7 +17,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.dom(".upload-progress[value='50']").exists();
|
||||
assert.dom(".uploading").hasText(I18n.t("uploading"));
|
||||
assert.dom(".uploading").hasText(i18n("uploading"));
|
||||
});
|
||||
|
||||
test("image - uploading in progress", async function (assert) {
|
||||
@ -31,7 +31,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
|
||||
assert.dom(".d-icon-far-image").exists();
|
||||
assert.dom(".upload-progress[value='78']").exists();
|
||||
assert.dom(".uploading").hasText(I18n.t("uploading"));
|
||||
assert.dom(".uploading").hasText(i18n("uploading"));
|
||||
});
|
||||
|
||||
test("image - preprocessing upload in progress", async function (assert) {
|
||||
@ -44,7 +44,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.dom(".processing").hasText(I18n.t("processing"));
|
||||
assert.dom(".processing").hasText(i18n("processing"));
|
||||
});
|
||||
|
||||
test("file - upload complete", async function (assert) {
|
||||
|
@ -3,7 +3,7 @@ import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import sinon from "sinon";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { HEADER_INDICATOR_PREFERENCE_ALL_NEW } from "discourse/plugins/chat/discourse/controllers/preferences-chat";
|
||||
|
||||
module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
@ -21,7 +21,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("chat.title_capitalized"))
|
||||
.hasAttribute("title", i18n("chat.title_capitalized"))
|
||||
.hasAttribute("href", "/chat");
|
||||
|
||||
assert.dom(".d-icon-d-chat").exists();
|
||||
@ -37,7 +37,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("sidebar.panels.forum.label"))
|
||||
.hasAttribute("title", i18n("sidebar.panels.forum.label"))
|
||||
.hasAttribute("href", "/latest");
|
||||
|
||||
assert.dom(".d-icon-shuffle").exists();
|
||||
@ -50,7 +50,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("chat.title_capitalized"))
|
||||
.hasAttribute("title", i18n("chat.title_capitalized"))
|
||||
.hasAttribute("href", "/chat");
|
||||
|
||||
assert.dom(".d-icon-d-chat").exists();
|
||||
@ -69,7 +69,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("sidebar.panels.forum.label"))
|
||||
.hasAttribute("title", i18n("sidebar.panels.forum.label"))
|
||||
.hasAttribute("href", "/latest");
|
||||
assert.dom(".d-icon-shuffle").exists();
|
||||
assert.dom(".chat-channel-unread-indicator__number").doesNotExist();
|
||||
@ -84,7 +84,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".icon.btn-flat")
|
||||
.hasAttribute("title", I18n.t("sidebar.panels.chat.label"))
|
||||
.hasAttribute("title", i18n("sidebar.panels.chat.label"))
|
||||
.hasAttribute("href", "/chat");
|
||||
assert.dom(".d-icon-d-chat").exists();
|
||||
assert
|
||||
|
@ -5,7 +5,7 @@ import { module, test } from "qunit";
|
||||
import Bookmark from "discourse/models/bookmark";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||||
|
||||
@ -28,7 +28,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
.hasText(this.message.chatWebhookEvent.username);
|
||||
assert.strictEqual(
|
||||
query(".chat-message-info__bot-indicator").textContent.trim(),
|
||||
I18n.t("chat.bot")
|
||||
i18n("chat.bot")
|
||||
);
|
||||
});
|
||||
|
||||
@ -108,7 +108,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".chat-message-info__flag > .svg-icon-title")
|
||||
.hasAttribute("title", I18n.t("chat.you_flagged"));
|
||||
.hasAttribute("title", i18n("chat.you_flagged"));
|
||||
});
|
||||
|
||||
test("reviewable", async function (assert) {
|
||||
@ -121,7 +121,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
|
||||
assert
|
||||
.dom(".chat-message-info__flag > .svg-icon-title")
|
||||
.hasAttribute("title", I18n.t("chat.you_flagged"));
|
||||
.hasAttribute("title", i18n("chat.you_flagged"));
|
||||
});
|
||||
|
||||
test("with username classes", async function (assert) {
|
||||
|
@ -4,7 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import CoreFabricators from "discourse/lib/fabricators";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module(
|
||||
@ -33,7 +33,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-message-left-gutter__flag .svg-icon-title")
|
||||
.hasAttribute("title", I18n.t("chat.flagged"));
|
||||
.hasAttribute("title", i18n("chat.flagged"));
|
||||
});
|
||||
|
||||
test("with flag status", async function (assert) {
|
||||
@ -45,7 +45,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-message-left-gutter__flag .svg-icon-title")
|
||||
.hasAttribute("title", I18n.t("chat.you_flagged"));
|
||||
.hasAttribute("title", i18n("chat.you_flagged"));
|
||||
});
|
||||
|
||||
test("bookmark", async function (assert) {
|
||||
|
@ -5,7 +5,7 @@ import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module("Discourse Chat | Component | chat-notice", function (hooks) {
|
||||
@ -90,7 +90,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
|
||||
assert.dom(".mention-without-membership-notice__body__text").hasText(text);
|
||||
assert
|
||||
.dom(".mention-without-membership-notice__body__link")
|
||||
.hasText(I18n.t("chat.mention_warning.invite"));
|
||||
.hasText(i18n("chat.mention_warning.invite"));
|
||||
|
||||
pretender.post(`/chat/api/channels/${this.channel.id}/invites`, () => {
|
||||
return [200, { "Content-Type": "application/json" }, {}];
|
||||
|
@ -2,7 +2,7 @@ import { render } from "@ember/test-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
||||
|
||||
module(
|
||||
@ -17,7 +17,7 @@ module(
|
||||
await render(hbs`<ChatRetentionReminder @channel={{this.channel}} />`);
|
||||
|
||||
assert.dom(".chat-retention-reminder").includesText(
|
||||
I18n.t("chat.retention_reminders.long", {
|
||||
i18n("chat.retention_reminders.long", {
|
||||
count: this.siteSettings.chat_channel_retention_days,
|
||||
})
|
||||
);
|
||||
@ -32,7 +32,7 @@ module(
|
||||
);
|
||||
|
||||
assert.dom(".chat-retention-reminder").includesText(
|
||||
I18n.t("chat.retention_reminders.short", {
|
||||
i18n("chat.retention_reminders.short", {
|
||||
count: this.siteSettings.chat_channel_retention_days,
|
||||
})
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ import { render } from "@ember/test-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module(
|
||||
@ -21,7 +21,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.indefinitely_long"));
|
||||
.includesText(i18n("chat.retention_reminders.indefinitely_long"));
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`
|
||||
@ -29,7 +29,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.indefinitely_short"));
|
||||
.includesText(i18n("chat.retention_reminders.indefinitely_short"));
|
||||
});
|
||||
|
||||
test("when channel is a public channel", async function (assert) {
|
||||
@ -42,7 +42,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.long", { count: 10 }));
|
||||
.includesText(i18n("chat.retention_reminders.long", { count: 10 }));
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`
|
||||
@ -50,7 +50,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.short", { count: 10 }));
|
||||
.includesText(i18n("chat.retention_reminders.short", { count: 10 }));
|
||||
});
|
||||
|
||||
test("when channel is a DM channel", async function (assert) {
|
||||
@ -63,7 +63,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.long", { count: 10 }));
|
||||
.includesText(i18n("chat.retention_reminders.long", { count: 10 }));
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`
|
||||
@ -71,7 +71,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.short", { count: 10 }));
|
||||
.includesText(i18n("chat.retention_reminders.short", { count: 10 }));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
|
||||
module(
|
||||
"Integration | Component | user-menu | chat-notifications-list",
|
||||
@ -24,7 +24,7 @@ module(
|
||||
assert.dom(".empty-state .empty-state-body").exists();
|
||||
assert.strictEqual(
|
||||
query(".empty-state .empty-state-title").textContent.trim(),
|
||||
I18n.t("user_menu.no_chat_notifications_title")
|
||||
i18n("user_menu.no_chat_notifications_title")
|
||||
);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user