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
909 changed files with 3453 additions and 3591 deletions

View File

@ -7,7 +7,7 @@ import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import loadScript from "discourse/lib/load-script";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class PollBreakdownModal extends Component {
@service dialog;
@ -66,7 +66,7 @@ export default class PollBreakdownModal extends Component {
if (error) {
popupAjaxError(error);
} else {
this.dialog.alert(I18n.t("poll.error_while_fetching_voters"));
this.dialog.alert(i18n("poll.error_while_fetching_voters"));
}
})
.then((result) => {

View File

@ -4,7 +4,7 @@ import { gt, or } from "@ember/object/computed";
import { service } from "@ember/service";
import { observes } from "@ember-decorators/object";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export const BAR_CHART_TYPE = "bar";
export const PIE_CHART_TYPE = "pie";
@ -46,22 +46,22 @@ export default class PollUiBuilderModal extends Component {
pollResults(staff) {
const options = [
{
name: I18n.t("poll.ui_builder.poll_result.always"),
name: i18n("poll.ui_builder.poll_result.always"),
value: ALWAYS_POLL_RESULT,
},
{
name: I18n.t("poll.ui_builder.poll_result.vote"),
name: i18n("poll.ui_builder.poll_result.vote"),
value: VOTE_POLL_RESULT,
},
{
name: I18n.t("poll.ui_builder.poll_result.closed"),
name: i18n("poll.ui_builder.poll_result.closed"),
value: CLOSED_POLL_RESULT,
},
];
if (staff) {
options.push({
name: I18n.t("poll.ui_builder.poll_result.staff"),
name: i18n("poll.ui_builder.poll_result.staff"),
value: STAFF_POLL_RESULT,
});
}
@ -224,14 +224,14 @@ export default class PollUiBuilderModal extends Component {
if (pollOptionsCount < 1) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.options_min_count"),
reason: i18n("poll.ui_builder.help.options_min_count"),
});
}
if (pollOptionsCount > this.siteSettings.poll_maximum_options) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.options_max_count", {
reason: i18n("poll.ui_builder.help.options_max_count", {
count: this.siteSettings.poll_maximum_options,
}),
});
@ -269,21 +269,21 @@ export default class PollUiBuilderModal extends Component {
if (pollMin < 0) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.invalid_min_value"),
reason: i18n("poll.ui_builder.help.invalid_min_value"),
});
}
if (pollMax < 0 || (isMultiple && pollMax > pollOptionsCount)) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.invalid_max_value"),
reason: i18n("poll.ui_builder.help.invalid_max_value"),
});
}
if (pollMin > pollMax) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.invalid_values"),
reason: i18n("poll.ui_builder.help.invalid_values"),
});
}
@ -291,7 +291,7 @@ export default class PollUiBuilderModal extends Component {
if (pollStep < 1) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.min_step_value"),
reason: i18n("poll.ui_builder.help.min_step_value"),
});
}
@ -300,14 +300,14 @@ export default class PollUiBuilderModal extends Component {
if (optionsCount < 1) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.options_min_count"),
reason: i18n("poll.ui_builder.help.options_min_count"),
});
}
if (optionsCount > this.siteSettings.poll_maximum_options) {
return EmberObject.create({
failed: true,
reason: I18n.t("poll.ui_builder.help.options_max_count", {
reason: i18n("poll.ui_builder.help.options_max_count", {
count: this.siteSettings.poll_maximum_options,
}),
});

View File

@ -4,9 +4,8 @@ import { equal } from "@ember/object/computed";
import { htmlSafe } from "@ember/template";
import { tagName } from "@ember-decorators/component";
import { propertyEqual } from "discourse/lib/computed";
import i18n from "discourse-common/helpers/i18n";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
import I18n, { i18n } from "discourse-i18n";
import { getColors } from "discourse/plugins/poll/lib/chart-colors";
@tagName("")

View File

@ -3,7 +3,7 @@ import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { relativeAge } from "discourse/lib/formatter";
import icon from "discourse-common/helpers/d-icon";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const ON_VOTE = "on_vote";
const ON_CLOSE = "on_close";
@ -18,13 +18,13 @@ export default class PollInfoComponent extends Component {
if (max > 0) {
if (min === max && min > 1) {
return htmlSafe(I18n.t("poll.multiple.help.x_options", { count: min }));
return htmlSafe(i18n("poll.multiple.help.x_options", { count: min }));
}
if (min > 1) {
if (max < optionsCount) {
return htmlSafe(
I18n.t("poll.multiple.help.between_min_and_max_options", {
i18n("poll.multiple.help.between_min_and_max_options", {
min,
max,
})
@ -32,20 +32,20 @@ export default class PollInfoComponent extends Component {
}
return htmlSafe(
I18n.t("poll.multiple.help.at_least_min_options", { count: min })
i18n("poll.multiple.help.at_least_min_options", { count: min })
);
}
if (max <= optionsCount) {
return htmlSafe(
I18n.t("poll.multiple.help.up_to_max_options", { count: max })
i18n("poll.multiple.help.up_to_max_options", { count: max })
);
}
}
}
get votersLabel() {
return I18n.t("poll.voters", { count: this.args.voters });
return i18n("poll.voters", { count: this.args.voters });
}
get showTotalVotes() {
@ -59,15 +59,15 @@ export default class PollInfoComponent extends Component {
}
get totalVotesLabel() {
return I18n.t("poll.total_votes", { count: this.totalVotes });
return i18n("poll.total_votes", { count: this.totalVotes });
}
get automaticCloseAgeLabel() {
return I18n.t("poll.automatic_close.age", this.age);
return i18n("poll.automatic_close.age", this.age);
}
get automaticCloseClosesInLabel() {
return I18n.t("poll.automatic_close.closes_in", this.timeLeft);
return i18n("poll.automatic_close.closes_in", this.timeLeft);
}
get showMultipleHelpText() {
@ -110,7 +110,7 @@ export default class PollInfoComponent extends Component {
}
get resultsOnVoteTitle() {
return htmlSafe(I18n.t("poll.results.vote.title"));
return htmlSafe(i18n("poll.results.vote.title"));
}
get resultsOnClose() {
@ -118,7 +118,7 @@ export default class PollInfoComponent extends Component {
}
get resultsOnCloseTitle() {
return htmlSafe(I18n.t("poll.results.closed.title"));
return htmlSafe(i18n("poll.results.closed.title"));
}
get resultsStaffOnly() {
@ -129,7 +129,7 @@ export default class PollInfoComponent extends Component {
}
get resultsStaffOnlyTitle() {
return htmlSafe(I18n.t("poll.results.staff.title"));
return htmlSafe(i18n("poll.results.staff.title"));
}
get publicTitle() {
@ -142,7 +142,7 @@ export default class PollInfoComponent extends Component {
}
get publicTitleLabel() {
return htmlSafe(I18n.t("poll.public.title"));
return htmlSafe(i18n("poll.public.title"));
}
get showInstructionsSection() {

View File

@ -4,7 +4,7 @@ import { action } from "@ember/object";
import DButton from "discourse/components/d-button";
import DropdownMenu from "discourse/components/dropdown-menu";
import icon from "discourse-common/helpers/d-icon";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import DMenu from "float-kit/components/d-menu";
export default class PollOptionsDropdownComponent extends Component {
@ -21,7 +21,7 @@ export default class PollOptionsDropdownComponent extends Component {
get rankLabel() {
return this.args.rank === 0
? I18n.t("poll.options.ranked_choice.abstain")
? i18n("poll.options.ranked_choice.abstain")
: this.args.rank;
}

View File

@ -4,7 +4,7 @@ import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import DButton from "discourse/components/d-button";
import routeAction from "discourse/helpers/route-action";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import PollOptionRankedChoiceDropdown from "./poll-option-ranked-choice-dropdown";
export default class PollOptionsComponent extends Component {

View File

@ -7,7 +7,7 @@ import { htmlSafe } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
import routeAction from "discourse/helpers/route-action";
import icon from "discourse-common/helpers/d-icon";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import PollOptionRankedChoice from "./poll-option-ranked-choice";
export default class PollOptionsComponent extends Component {
@ -32,7 +32,7 @@ export default class PollOptionsComponent extends Component {
rankedChoiceDropdownContent.push({
id: 0,
name: I18n.t("poll.options.ranked_choice.abstain"),
name: i18n("poll.options.ranked_choice.abstain"),
});
this.args.options.forEach((option, i) => {
@ -40,11 +40,11 @@ export default class PollOptionsComponent extends Component {
let priority = "";
if (i === 0) {
priority = ` ${I18n.t("poll.options.ranked_choice.highest_priority")}`;
priority = ` ${i18n("poll.options.ranked_choice.highest_priority")}`;
}
if (i === this.args.options.length - 1) {
priority = ` ${I18n.t("poll.options.ranked_choice.lowest_priority")}`;
priority = ` ${i18n("poll.options.ranked_choice.lowest_priority")}`;
}
rankedChoiceDropdownContent.push({

View File

@ -1,12 +1,11 @@
import Component from "@glimmer/component";
import { htmlSafe } from "@ember/template";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
export default class PollResultsRankedChoiceComponent extends Component {
get rankedChoiceWinnerText() {
return htmlSafe(
I18n.t("poll.ranked_choice.winner", {
i18n("poll.ranked_choice.winner", {
count: this.args.rankedChoiceOutcome?.round_activity?.length,
winner: this.args.rankedChoiceOutcome?.winning_candidate?.html,
})
@ -14,7 +13,7 @@ export default class PollResultsRankedChoiceComponent extends Component {
}
get rankedChoiceTiedText() {
return I18n.t("poll.ranked_choice.tied", {
return i18n("poll.ranked_choice.tied", {
count: this.args.rankedChoiceOutcome?.round_activity?.length,
});
}

View File

@ -1,7 +1,7 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
import { htmlSafe } from "@ember/template";
import i18n from "discourse-common/helpers/i18n";
import { i18n } from "discourse-i18n";
import evenRound from "discourse/plugins/poll/lib/even-round";
import PollVoters from "./poll-voters";

View File

@ -4,14 +4,14 @@ import { fn } from "@ember/helper";
import { action } from "@ember/object";
import { eq } from "truth-helpers";
import DButton from "discourse/components/d-button";
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
import PollResultsRankedChoice from "./poll-results-ranked-choice";
import PollResultsStandard from "./poll-results-standard";
export default class TabsComponent extends Component {
@tracked activeTab;
tabOne = I18n.t("poll.results.tabs.votes");
tabTwo = I18n.t("poll.results.tabs.outcome");
tabOne = i18n("poll.results.tabs.votes");
tabTwo = i18n("poll.results.tabs.outcome");
constructor() {
super(...arguments);

View File

@ -9,8 +9,7 @@ import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import round from "discourse/lib/round";
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 PollBreakdownModal from "../components/modal/poll-breakdown";
import {
MULTIPLE_POLL_TYPE,
@ -243,7 +242,7 @@ export default class PollComponent extends Component {
}
popupAjaxError(error);
} else {
this.dialog.alert(I18n.t("poll.error_while_casting_votes"));
this.dialog.alert(i18n("poll.error_while_casting_votes"));
}
}
}
@ -378,7 +377,7 @@ export default class PollComponent extends Component {
}
get pollGroups() {
return I18n.t("poll.results.groups.title", { groups: this.poll.groups });
return i18n("poll.results.groups.title", { groups: this.poll.groups });
}
get showCastVotesButton() {
@ -445,7 +444,7 @@ export default class PollComponent extends Component {
const average = this.voters === 0 ? 0 : round(totalScore / this.voters, -2);
return htmlSafe(I18n.t("poll.average_rating", { average }));
return htmlSafe(i18n("poll.average_rating", { average }));
}
get availableDisplayMode() {
@ -527,7 +526,7 @@ export default class PollComponent extends Component {
if (error) {
popupAjaxError(error);
} else {
this.dialog.alert(I18n.t("poll.error_while_fetching_voters"));
this.dialog.alert(i18n("poll.error_while_fetching_voters"));
}
})
.finally(() => {
@ -573,7 +572,7 @@ export default class PollComponent extends Component {
}
this.dialog.yesNoConfirm({
message: I18n.t(this.closed ? "poll.open.confirm" : "poll.close.confirm"),
message: i18n(this.closed ? "poll.open.confirm" : "poll.close.confirm"),
didConfirm: () => {
const status = this.closed ? OPEN_STATUS : CLOSED_STATUS;
ajax("/polls/toggle_status", {
@ -607,7 +606,7 @@ export default class PollComponent extends Component {
if (error) {
popupAjaxError(error);
} else {
this.dialog.alert(I18n.t("poll.error_while_toggling_status"));
this.dialog.alert(i18n("poll.error_while_toggling_status"));
}
});
},
@ -663,7 +662,7 @@ export default class PollComponent extends Component {
if (error) {
popupAjaxError(error);
} else {
this.dialog.alert(I18n.t("poll.error_while_exporting_results"));
this.dialog.alert(i18n("poll.error_while_exporting_results"));
}
});
}

View File

@ -1,5 +1,5 @@
/*eslint no-bitwise:0 */
import I18n from "discourse-i18n";
import { i18n } from "discourse-i18n";
const DATA_PREFIX = "data-poll-";
const DEFAULT_POLL = { name: "poll", status: "open" };
@ -97,7 +97,7 @@ function addPollInfo(state) {
token.block = false;
token = state.push("text", "", 0);
token.content = I18n.t("poll.voters", { count: 0 });
token.content = i18n("poll.voters", { count: 0 });
state.push("poll_info_label_close", "span", -1);
state.push("poll_info_counts_count_close", "div", -1);

View File

@ -5,7 +5,7 @@ import {
acceptance,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
import { i18n } from 'discourse-i18n';
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
acceptance("Poll Builder - polls are enabled", function (needs) {
@ -25,7 +25,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
await displayPollBuilderButton();
const pollBuilderButtonSelector = `.select-kit-row[data-name='${I18n.t(
const pollBuilderButtonSelector = `.select-kit-row[data-name='${i18n(
"poll.ui_builder.title"
)}']`;
@ -71,7 +71,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
await displayPollBuilderButton();
assert
.dom(`.select-kit-row[data-name='${I18n.t("poll.ui_builder.title")}']`)
.dom(`.select-kit-row[data-name='${i18n("poll.ui_builder.title")}']`)
.exists("it shows the builder button");
});
});

View File

@ -5,7 +5,7 @@ import {
publishToMessageBus,
query,
} from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
import { i18n } from 'discourse-i18n';
acceptance("Poll results", function (needs) {
needs.user();
@ -1121,7 +1121,7 @@ acceptance("Poll results", function (needs) {
query(
".poll-container .discourse-poll-ranked_choice-results .tab-container .tab.nav-item.active button"
).innerText,
I18n.t("poll.results.tabs.outcome"),
i18n("poll.results.tabs.outcome"),
"Outcome tab is active"
);
@ -1133,7 +1133,7 @@ acceptance("Poll results", function (needs) {
query(
".poll-container .discourse-poll-ranked_choice-results .tab-container .tab.nav-item.active button"
).innerText,
I18n.t("poll.results.tabs.votes"),
i18n("poll.results.tabs.votes"),
"Votes tab is active"
);

View File

@ -3,7 +3,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';
module("Poll | Component | poll-buttons-dropdown", function (hooks) {
setupRenderingTest(hooks);
@ -40,7 +40,7 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
assert.dom("li.dropdown-menu__item").exists({ count: 2 });
assert.strictEqual(
query("li.dropdown-menu__item span").textContent.trim(),
I18n.t("poll.export-results.label"),
i18n("poll.export-results.label"),
"displays the poll Export action"
);
});
@ -76,7 +76,7 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
assert
.dom(query("li.dropdown-menu__item span"))
.hasText(
I18n.t("poll.show-tally.label"),
i18n("poll.show-tally.label"),
"displays the show absolute button"
);
});
@ -108,7 +108,7 @@ module("Poll | Component | poll-buttons-dropdown", function (hooks) {
assert.dom("button.widget-button").exists({ count: 1 });
assert.strictEqual(
query("button.widget-button span.d-button-label").textContent.trim(),
I18n.t("poll.breakdown.breakdown"),
i18n("poll.breakdown.breakdown"),
"displays the poll Close action"
);
});

View File

@ -3,7 +3,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';
const OPTIONS = [
{ id: "1ddc47be0d2315b9711ee8526ca9d83f", html: "This", votes: 2, rank: 0 },
@ -47,7 +47,7 @@ module("Poll | Component | poll-info", function (hooks) {
assert.strictEqual(
query(".poll-info_instructions li.multiple-help-text").textContent.trim(),
I18n.t("poll.multiple.help.up_to_max_options", {
i18n("poll.multiple.help.up_to_max_options", {
count: this.max,
}).replace(/<\/?[^>]+(>|$)/g, ""),
"displays the multiple help text"
@ -55,7 +55,7 @@ module("Poll | Component | poll-info", function (hooks) {
assert.strictEqual(
query(".poll-info_instructions li.is-public").textContent.trim(),
I18n.t("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
i18n("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
"displays the public label"
);
});
@ -93,7 +93,7 @@ module("Poll | Component | poll-info", function (hooks) {
assert.strictEqual(
query(".poll-info_instructions li.multiple-help-text").textContent.trim(),
I18n.t("poll.multiple.help.up_to_max_options", {
i18n("poll.multiple.help.up_to_max_options", {
count: this.max,
}).replace(/<\/?[^>]+(>|$)/g, ""),
"displays the multiple help text"
@ -103,13 +103,13 @@ module("Poll | Component | poll-info", function (hooks) {
query(
".poll-info_instructions li.results-on-vote span"
).textContent.trim(),
I18n.t("poll.results.vote.title").replace(/<\/?[^>]+(>|$)/g, ""),
i18n("poll.results.vote.title").replace(/<\/?[^>]+(>|$)/g, ""),
"displays the results on vote label"
);
assert.strictEqual(
query(".poll-info_instructions li.is-public").textContent.trim(),
I18n.t("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
i18n("poll.public.title").replace(/<\/?[^>]+(>|$)/g, ""),
"displays the public label"
);
});

View File

@ -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';
const OPTIONS = [
{ id: "1ddc47be0d2315b9711ee8526ca9d83f", html: "This", votes: 0, rank: 0 },
@ -155,10 +155,10 @@ module("Poll | Component | poll-options", function (hooks) {
assert
.dom(".dropdown-menu__item:nth-child(2)")
.hasText(`1 ${I18n.t("poll.options.ranked_choice.highest_priority")}`);
.hasText(`1 ${i18n("poll.options.ranked_choice.highest_priority")}`);
assert
.dom(".dropdown-menu__item:nth-child(4)")
.hasText(`3 ${I18n.t("poll.options.ranked_choice.lowest_priority")}`);
.hasText(`3 ${i18n("poll.options.ranked_choice.lowest_priority")}`);
});
});

View File

@ -3,7 +3,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';
const RANKED_CHOICE_OUTCOME = {
tied: false,
@ -49,7 +49,7 @@ module("Poll | Component | poll-results-ranked-choice", function (hooks) {
assert.strictEqual(
query("span.poll-results-ranked-choice-info").textContent.trim(),
I18n.t("poll.ranked_choice.winner", {
i18n("poll.ranked_choice.winner", {
count: this.rankedChoiceOutcome.round_activity.length,
winner: this.rankedChoiceOutcome.winning_candidate.html,
}),

View File

@ -3,7 +3,7 @@ import hbs from "htmlbars-inline-precompile";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
import { i18n } from 'discourse-i18n';
const TWO_OPTIONS = [
{ id: "1ddc47be0d2315b9711ee8526ca9d83f", html: "This", votes: 5, rank: 0 },
@ -188,13 +188,13 @@ module("Poll | Component | poll-results-standard", function (hooks) {
/>`);
let percentages = queryAll(".option .absolute");
assert.dom(percentages[0]).hasText(I18n.t("poll.votes", { count: 5 }));
assert.dom(percentages[1]).hasText(I18n.t("poll.votes", { count: 4 }));
assert.dom(percentages[2]).hasText(I18n.t("poll.votes", { count: 2 }));
assert.dom(percentages[3]).hasText(I18n.t("poll.votes", { count: 1 }));
assert.dom(percentages[0]).hasText(i18n("poll.votes", { count: 5 }));
assert.dom(percentages[1]).hasText(i18n("poll.votes", { count: 4 }));
assert.dom(percentages[2]).hasText(i18n("poll.votes", { count: 2 }));
assert.dom(percentages[3]).hasText(i18n("poll.votes", { count: 1 }));
assert.dom(queryAll(".option")[3].querySelectorAll("span")[1]).hasText("a");
assert.dom(percentages[4]).hasText(I18n.t("poll.votes", { count: 1 }));
assert.dom(percentages[4]).hasText(i18n("poll.votes", { count: 1 }));
assert.dom(queryAll(".option")[4].querySelectorAll("span")[1]).hasText("b");
});
});

View File

@ -5,7 +5,7 @@ import hbs from "htmlbars-inline-precompile";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
import I18n from "discourse-i18n";
import { i18n } from 'discourse-i18n';
let requests = 0;
@ -171,7 +171,7 @@ module("Poll | Component | poll", function (hooks) {
);
assert
.dom(".poll-container .alert")
.hasText(I18n.t("poll.results.groups.title", { groups: "foo" }));
.hasText(i18n("poll.results.groups.title", { groups: "foo" }));
assert.strictEqual(requests, 0);
assert.dom(".chosen").doesNotExist();
});