mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 06:55:03 -05:00
DEV: introduces prettier for es6 files
This commit is contained in:
@@ -7,50 +7,50 @@ QUnit.module("lib:i18n", {
|
||||
I18n.locale = "fr";
|
||||
|
||||
I18n.translations = {
|
||||
"fr_FOO": {
|
||||
"js": {
|
||||
"topic": {
|
||||
"reply": {
|
||||
"title": "Foo"
|
||||
fr_FOO: {
|
||||
js: {
|
||||
topic: {
|
||||
reply: {
|
||||
title: "Foo"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"fr": {
|
||||
"js": {
|
||||
"hello": "Bonjour",
|
||||
"topic": {
|
||||
"reply": {
|
||||
"title": "Répondre"
|
||||
},
|
||||
"share": {
|
||||
"title": "Partager"
|
||||
}
|
||||
},
|
||||
"character_count": {
|
||||
"zero": "{{count}} ZERO",
|
||||
"one": "{{count}} ONE",
|
||||
"two": "{{count}} TWO",
|
||||
"few": "{{count}} FEW",
|
||||
"many": "{{count}} MANY",
|
||||
"other": "{{count}} OTHER"
|
||||
}
|
||||
}
|
||||
},
|
||||
"en": {
|
||||
"js": {
|
||||
"hello": {
|
||||
"world": "Hello World!",
|
||||
"universe": ""
|
||||
},
|
||||
"topic": {
|
||||
"reply": {
|
||||
"help": "begin composing a reply to this topic"
|
||||
fr: {
|
||||
js: {
|
||||
hello: "Bonjour",
|
||||
topic: {
|
||||
reply: {
|
||||
title: "Répondre"
|
||||
},
|
||||
share: {
|
||||
title: "Partager"
|
||||
}
|
||||
},
|
||||
"word_count": {
|
||||
"one": "1 word",
|
||||
"other": "{{count}} words"
|
||||
character_count: {
|
||||
zero: "{{count}} ZERO",
|
||||
one: "{{count}} ONE",
|
||||
two: "{{count}} TWO",
|
||||
few: "{{count}} FEW",
|
||||
many: "{{count}} MANY",
|
||||
other: "{{count}} OTHER"
|
||||
}
|
||||
}
|
||||
},
|
||||
en: {
|
||||
js: {
|
||||
hello: {
|
||||
world: "Hello World!",
|
||||
universe: ""
|
||||
},
|
||||
topic: {
|
||||
reply: {
|
||||
help: "begin composing a reply to this topic"
|
||||
}
|
||||
},
|
||||
word_count: {
|
||||
one: "1 word",
|
||||
other: "{{count}} words"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ QUnit.module("lib:i18n", {
|
||||
if (n === 0) return "zero";
|
||||
if (n === 1) return "one";
|
||||
if (n === 2) return "two";
|
||||
if (n >= 3 && n <= 9) return "few";
|
||||
if (n >= 3 && n <= 9) return "few";
|
||||
if (n >= 10 && n <= 99) return "many";
|
||||
return "other";
|
||||
};
|
||||
@@ -80,16 +80,32 @@ QUnit.test("defaults", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("translations", assert => {
|
||||
assert.equal(I18n.t("topic.reply.title"), "Répondre", "uses locale translations when they exist");
|
||||
assert.equal(I18n.t("topic.reply.help"), "begin composing a reply to this topic", "fallbacks to English translations");
|
||||
assert.equal(I18n.t("hello.world"), "Hello World!", "doesn't break if a key is overriden in a locale");
|
||||
assert.equal(
|
||||
I18n.t("topic.reply.title"),
|
||||
"Répondre",
|
||||
"uses locale translations when they exist"
|
||||
);
|
||||
assert.equal(
|
||||
I18n.t("topic.reply.help"),
|
||||
"begin composing a reply to this topic",
|
||||
"fallbacks to English translations"
|
||||
);
|
||||
assert.equal(
|
||||
I18n.t("hello.world"),
|
||||
"Hello World!",
|
||||
"doesn't break if a key is overriden in a locale"
|
||||
);
|
||||
assert.equal(I18n.t("hello.universe"), "", "allows empty strings");
|
||||
});
|
||||
|
||||
QUnit.test("extra translations", assert => {
|
||||
I18n.extras = [{ "admin": { "title": "Discourse Admin" }}];
|
||||
I18n.extras = [{ admin: { title: "Discourse Admin" } }];
|
||||
|
||||
assert.equal(I18n.t("admin.title"), "Discourse Admin", "it check extra translations when they exists");
|
||||
assert.equal(
|
||||
I18n.t("admin.title"),
|
||||
"Discourse Admin",
|
||||
"it check extra translations when they exists"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("pluralizations", assert => {
|
||||
@@ -112,7 +128,19 @@ QUnit.test("fallback", assert => {
|
||||
I18n.locale = "fr_FOO";
|
||||
I18n.fallbackLocale = "fr";
|
||||
|
||||
assert.equal(I18n.t("topic.reply.title"), "Foo", "uses locale translations when they exist");
|
||||
assert.equal(I18n.t("topic.share.title"), "Partager", "falls back to fallbackLocale translations when they exist");
|
||||
assert.equal(I18n.t("topic.reply.help"), "begin composing a reply to this topic", "falls back to English translations");
|
||||
assert.equal(
|
||||
I18n.t("topic.reply.title"),
|
||||
"Foo",
|
||||
"uses locale translations when they exist"
|
||||
);
|
||||
assert.equal(
|
||||
I18n.t("topic.share.title"),
|
||||
"Partager",
|
||||
"falls back to fallbackLocale translations when they exist"
|
||||
);
|
||||
assert.equal(
|
||||
I18n.t("topic.reply.help"),
|
||||
"begin composing a reply to this topic",
|
||||
"falls back to English translations"
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user