mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
add support for getting strings under clientSideStrings and update sample
This commit is contained in:
parent
be2010b0a2
commit
22267805ee
2 changed files with 8 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"languageName": "English",
|
||||
"1": "server",
|
||||
"removeAds": "Remove Ads",
|
||||
"clientSideStrings": {
|
||||
"1": "client"
|
||||
"removeAds": "Remove Ads Client Side"
|
||||
}
|
||||
}
|
||||
|
|
@ -95,9 +95,12 @@ var getTranslatedString = function(locale, string){
|
|||
//if(!translations[locale]) throw new Error("Missing locale '" + locale + "'");
|
||||
|
||||
// TODO support nested dot-separated strings
|
||||
if(translations[locale][string]) return translations[locale][string];
|
||||
if(translations['en'][string]) return translations['en'][string];
|
||||
return 'String not found.';
|
||||
return (
|
||||
translations[locale][string] ||
|
||||
translations[locale]['clientSideStrings'][string] ||
|
||||
translations['en'][string] ||
|
||||
translations['en']['clientSideStrings'][string] ||
|
||||
'String not found.')
|
||||
}
|
||||
|
||||
var avalaibleLanguages = _.map(langCodes, function(langCode){
|
||||
|
|
|
|||
Loading…
Reference in a new issue