mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: introduces prettier for es6 files
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import PreloadStore from 'preload-store';
|
||||
import LocalizationInitializer from 'discourse/initializers/localization';
|
||||
import PreloadStore from "preload-store";
|
||||
import LocalizationInitializer from "discourse/initializers/localization";
|
||||
|
||||
QUnit.module("initializer:localization", {
|
||||
_locale: I18n.locale,
|
||||
@ -9,18 +9,18 @@ QUnit.module("initializer:localization", {
|
||||
I18n.locale = "fr";
|
||||
|
||||
I18n.translations = {
|
||||
"fr": {
|
||||
"js": {
|
||||
"composer": {
|
||||
"reply": "Répondre"
|
||||
fr: {
|
||||
js: {
|
||||
composer: {
|
||||
reply: "Répondre"
|
||||
}
|
||||
}
|
||||
},
|
||||
"en": {
|
||||
"js": {
|
||||
"topic": {
|
||||
"reply": {
|
||||
"help": "begin composing a reply to this topic"
|
||||
en: {
|
||||
js: {
|
||||
topic: {
|
||||
reply: {
|
||||
help: "begin composing a reply to this topic"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,16 +35,33 @@ QUnit.module("initializer:localization", {
|
||||
});
|
||||
|
||||
QUnit.test("translation overrides", function(assert) {
|
||||
PreloadStore.store('translationOverrides', {"js.composer.reply":"WAT","js.topic.reply.help":"foobar"});
|
||||
PreloadStore.store("translationOverrides", {
|
||||
"js.composer.reply": "WAT",
|
||||
"js.topic.reply.help": "foobar"
|
||||
});
|
||||
LocalizationInitializer.initialize(this.registry);
|
||||
|
||||
assert.equal(I18n.t("composer.reply"), "WAT", "overrides existing translation in current locale");
|
||||
assert.equal(I18n.t("topic.reply.help"), "foobar", "overrides translation in default locale");
|
||||
assert.equal(
|
||||
I18n.t("composer.reply"),
|
||||
"WAT",
|
||||
"overrides existing translation in current locale"
|
||||
);
|
||||
assert.equal(
|
||||
I18n.t("topic.reply.help"),
|
||||
"foobar",
|
||||
"overrides translation in default locale"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("skip translation override if parent node is not an object", function(assert) {
|
||||
PreloadStore.store('translationOverrides', {"js.composer.reply":"WAT","js.composer.reply.help":"foobar"});
|
||||
LocalizationInitializer.initialize(this.registry);
|
||||
QUnit.test(
|
||||
"skip translation override if parent node is not an object",
|
||||
function(assert) {
|
||||
PreloadStore.store("translationOverrides", {
|
||||
"js.composer.reply": "WAT",
|
||||
"js.composer.reply.help": "foobar"
|
||||
});
|
||||
LocalizationInitializer.initialize(this.registry);
|
||||
|
||||
assert.equal(I18n.t("composer.reply.help"), "[fr.composer.reply.help]");
|
||||
});
|
||||
assert.equal(I18n.t("composer.reply.help"), "[fr.composer.reply.help]");
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user