fix Ox.setLocale
This commit is contained in:
parent
50a845fa29
commit
dbc971d1c9
1 changed files with 8 additions and 3 deletions
|
@ -16,7 +16,7 @@
|
|||
Ox.setLocale <f> Sets locale
|
||||
(locale[, url], callback)
|
||||
locale <s> Locale (like 'de' or 'fr')
|
||||
url <s> URL of JSON file with additional translations
|
||||
url <s|[s]> one or more URLs of JSON file with additional translations
|
||||
callback <f> Callback function
|
||||
success <b> If true, locale has been set
|
||||
@*/
|
||||
|
@ -34,14 +34,19 @@
|
|||
callback(true);
|
||||
} else {
|
||||
Ox.forEach(Ox.LOCALES, function(locales, module) {
|
||||
if (Ox.load[module] && Ox.contains(locales, locale)) {
|
||||
if (
|
||||
(!module || Ox.load[module])
|
||||
&& Ox.contains(locales, locale)
|
||||
) {
|
||||
urls.push([
|
||||
Ox.PATH + 'Ox' + (module ? '.' + module : '')
|
||||
+ '/json/locale.' + locale + '.json'
|
||||
]);
|
||||
}
|
||||
});
|
||||
url && urls.push([url]);
|
||||
url && url.forEach(function(value) {
|
||||
urls.push(Ox.makeArray(value));
|
||||
});
|
||||
Ox.getJSON(urls, function(data) {
|
||||
urls.forEach(function(url) {
|
||||
Ox.extend(translations, data[url]);
|
||||
|
|
Loading…
Reference in a new issue