use english for incomplete translations

This commit is contained in:
hamza zia 2015-10-31 10:58:25 +08:00
parent 5c91378795
commit 4c344c0bba

View File

@ -13,12 +13,26 @@ var webui = angular.module('webui', [
'pascalprecht.translate' 'pascalprecht.translate'
]); ]);
function mergeTranslation(translation, base) {
for (var i in base) {
if (!base.hasOwnProperty(i)) {
continue;
}
if (!translation[i] || !translation[i].length) {
translation[i] = base[i];
}
}
return translation;
}
webui.config(['$translateProvider', function ($translateProvider) { webui.config(['$translateProvider', function ($translateProvider) {
$translateProvider $translateProvider
.translations('nl_NL', translations.nl_NL)
.translations('en_US', translations.en_US) .translations('en_US', translations.en_US)
.translations('th_TH', translations.th_TH) .translations('nl_NL', mergeTranslation(translations.nl_NL, translations.en_US))
.translations('zh_CN', translations.zh_CN) .translations('th_TH', mergeTranslation(translations.th_TH, translations.en_US))
.translations('zh_CN', mergeTranslation(translations.zh_CN, translations.en_US))
.determinePreferredLanguage(); .determinePreferredLanguage();
}]); }]);