mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: allow for empty translated strings
This commit is contained in:
parent
e27b1b98d1
commit
b20b568039
@ -73,7 +73,13 @@ I18n.lookup = function(scope, options) {
|
||||
messages = messages[currentScope];
|
||||
}
|
||||
|
||||
messages = messages || checkExtras(origScope, this.SEPARATOR, this.extras) || options.defaultValue;
|
||||
if (messages === undefined) {
|
||||
messages = checkExtras(origScope, this.SEPARATOR, this.extras);
|
||||
}
|
||||
|
||||
if (messages === undefined) {
|
||||
messages = options.defaultValue;
|
||||
}
|
||||
|
||||
return messages;
|
||||
};
|
||||
|
@ -27,7 +27,8 @@ module("lib:i18n", {
|
||||
"en": {
|
||||
"js": {
|
||||
"hello": {
|
||||
"world": "Hello World!"
|
||||
"world": "Hello World!",
|
||||
"universe": ""
|
||||
},
|
||||
"topic": {
|
||||
"reply": {
|
||||
@ -68,6 +69,7 @@ test("translations", function() {
|
||||
equal(I18n.t("topic.reply.title"), "Répondre", "uses locale translations when they exist");
|
||||
equal(I18n.t("topic.reply.help"), "begin composing a reply to this topic", "fallbacks to English translations");
|
||||
equal(I18n.t("hello.world"), "Hello World!", "doesn't break if a key is overriden in a locale");
|
||||
equal(I18n.t("hello.universe"), "", "allows empty strings");
|
||||
});
|
||||
|
||||
test("extra translations", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user