From dbc971d1c9224ae932081c1e54947a349b7c050b Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 9 May 2013 22:32:50 +0200 Subject: [PATCH] fix Ox.setLocale --- source/Ox/js/Locale.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/Ox/js/Locale.js b/source/Ox/js/Locale.js index 9895fd3f..62ab902a 100644 --- a/source/Ox/js/Locale.js +++ b/source/Ox/js/Locale.js @@ -16,7 +16,7 @@ Ox.setLocale Sets locale (locale[, url], callback) locale Locale (like 'de' or 'fr') - url URL of JSON file with additional translations + url one or more URLs of JSON file with additional translations callback Callback function success 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]);