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
|
Ox.setLocale <f> Sets locale
|
||||||
(locale[, url], callback)
|
(locale[, url], callback)
|
||||||
locale <s> Locale (like 'de' or 'fr')
|
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
|
callback <f> Callback function
|
||||||
success <b> If true, locale has been set
|
success <b> If true, locale has been set
|
||||||
@*/
|
@*/
|
||||||
|
@ -34,14 +34,19 @@
|
||||||
callback(true);
|
callback(true);
|
||||||
} else {
|
} else {
|
||||||
Ox.forEach(Ox.LOCALES, function(locales, module) {
|
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([
|
urls.push([
|
||||||
Ox.PATH + 'Ox' + (module ? '.' + module : '')
|
Ox.PATH + 'Ox' + (module ? '.' + module : '')
|
||||||
+ '/json/locale.' + locale + '.json'
|
+ '/json/locale.' + locale + '.json'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
url && urls.push([url]);
|
url && url.forEach(function(value) {
|
||||||
|
urls.push(Ox.makeArray(value));
|
||||||
|
});
|
||||||
Ox.getJSON(urls, function(data) {
|
Ox.getJSON(urls, function(data) {
|
||||||
urls.forEach(function(url) {
|
urls.forEach(function(url) {
|
||||||
Ox.extend(translations, data[url]);
|
Ox.extend(translations, data[url]);
|
||||||
|
|
Loading…
Reference in a new issue