mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-01 10:14:28 +02:00
PR #269 do better job of showing untranslated hints or level names
This commit is contained in:
parent
ad55c6705c
commit
8550519529
1 changed files with 12 additions and 5 deletions
|
@ -34,7 +34,7 @@ var str = exports.str = function(key, params) {
|
||||||
var locale = LocaleStore.getLocale();
|
var locale = LocaleStore.getLocale();
|
||||||
if (!strings[key]) {
|
if (!strings[key]) {
|
||||||
console.warn('NO INTL support for key ' + key);
|
console.warn('NO INTL support for key ' + key);
|
||||||
return 'NO INTL support for key ' + key;
|
return 'NO INTL support for key ' + key + '. this is probably a dev error';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strings[key][locale]) {
|
if (!strings[key][locale]) {
|
||||||
|
@ -55,7 +55,7 @@ var str = exports.str = function(key, params) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var getIntlKey = exports.getIntlKey = function(obj, key) {
|
var getIntlKey = exports.getIntlKey = function(obj, key, overrideLocale) {
|
||||||
if (!obj || !obj[key]) {
|
if (!obj || !obj[key]) {
|
||||||
throw new Error('that key ' + key + 'doesnt exist in this blob' + obj);
|
throw new Error('that key ' + key + 'doesnt exist in this blob' + obj);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,8 @@ var getIntlKey = exports.getIntlKey = function(obj, key) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj[key][LocaleStore.getLocale()];
|
var locale = overrideLocale || LocaleStore.getLocale();
|
||||||
|
return obj[key][locale];
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.todo = function(str) {
|
exports.todo = function(str) {
|
||||||
|
@ -80,11 +81,17 @@ exports.getDialog = function(obj) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getHint = function(level) {
|
exports.getHint = function(level) {
|
||||||
return getIntlKey(level, 'hint') || str('error-untranslated');
|
if (!getIntlKey(level, 'hint')) {
|
||||||
|
return getIntlKey(level, 'hint', getDefaultLocale()) + ' -- ' + str('error-untranslated');
|
||||||
|
}
|
||||||
|
return getIntlKey(level, 'hint');
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getName = function(level) {
|
exports.getName = function(level) {
|
||||||
return getIntlKey(level, 'name') || str('error-untranslated');
|
if (!getIntlKey(level, 'name')) {
|
||||||
|
return getIntlKey(level, 'name', getDefaultLocale()) + ' -- ' + str('error-untranslated');
|
||||||
|
}
|
||||||
|
return getIntlKey(level, 'name');
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getStartDialog = function(level) {
|
exports.getStartDialog = function(level) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue