From 81bea17aefb26859f825b9293c7c99192874806e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 8 Nov 2011 20:40:44 +0400 Subject: upgrade Dojo to 1.6.1 --- lib/dojo/i18n.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lib/dojo/i18n.js') diff --git a/lib/dojo/i18n.js b/lib/dojo/i18n.js index d06a8f25e..893490fe0 100644 --- a/lib/dojo/i18n.js +++ b/lib/dojo/i18n.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ @@ -9,13 +9,16 @@ if(!dojo._hasResource["dojo.i18n"]){ //_hasResource checks added by build. Do no dojo._hasResource["dojo.i18n"] = true; dojo.provide("dojo.i18n"); +dojo.getObject("i18n", true, dojo); + /*===== dojo.i18n = { // summary: Utility classes to enable loading of resources for internationalization (i18n) }; =====*/ -dojo.i18n.getLocalization = function(/*String*/packageName, /*String*/bundleName, /*String?*/locale){ +// when using a real AMD loader, dojo.i18n.getLocalization is already defined by dojo/lib/backCompat +dojo.i18n.getLocalization = dojo.i18n.getLocalization || function(/*String*/packageName, /*String*/bundleName, /*String?*/locale){ // summary: // Returns an Object containing the localization for a given resource // bundle in a package, matching the specified locale. @@ -43,7 +46,7 @@ dojo.i18n.getLocalization = function(/*String*/packageName, /*String*/bundleName // look for nearest locale match var elements = locale.split('-'); var module = [packageName,"nls",bundleName].join('.'); - var bundle = dojo._loadedModules[module]; + var bundle = dojo._loadedModules[module]; if(bundle){ var localization; for(var i = elements.length; i > 0; i--){ @@ -93,7 +96,7 @@ dojo.i18n._requireLocalization = function(/*String*/moduleName, /*String*/bundle var targetLocale = dojo.i18n.normalizeLocale(locale); var bundlePackage = [moduleName, "nls", bundleName].join("."); - // NOTE: + // NOTE: // When loading these resources, the packaging does not match what is // on disk. This is an implementation detail, as this is just a // private data structure to hold the loaded resources. e.g. @@ -103,7 +106,7 @@ dojo.i18n._requireLocalization = function(/*String*/moduleName, /*String*/bundle // in memory it is more logical and efficient to store in a different // order. Locales cannot use dashes, since the resulting path will // not evaluate as valid JS, so we translate them to underscores. - + //Find the best-match locale to load if we have available flat locales. var bestLocale = ""; if(availableFlatLocales){ @@ -120,7 +123,7 @@ dojo.i18n._requireLocalization = function(/*String*/moduleName, /*String*/bundle } if(!bestLocale){ bestLocale = "ROOT"; - } + } } //See if the desired locale is already loaded. @@ -152,6 +155,7 @@ dojo.i18n._requireLocalization = function(/*String*/moduleName, /*String*/bundle module.push(bundleName); var filespec = module.join("/") + '.js'; loaded = dojo._loadPath(filespec, null, function(hash){ + hash = hash.root || hash; // Use singleton with prototype to point to parent bundle, then mix-in result from loadPath var clazz = function(){}; clazz.prototype = parent; @@ -166,7 +170,7 @@ dojo.i18n._requireLocalization = function(/*String*/moduleName, /*String*/bundle }else{ bundle[jsLoc] = parent; } - + if(availableFlatLocales){ //Stop the locale path searching if we know the availableFlatLocales, since //the first call to this function will load the only bundle that is needed. @@ -184,8 +188,8 @@ dojo.i18n._requireLocalization = function(/*String*/moduleName, /*String*/bundle (function(){ // If other locales are used, dojo.requireLocalization should load them as - // well, by default. - // + // well, by default. + // // Override dojo.requireLocalization to do load the default bundle, then // iterate through the extraLocale list and load those translations as // well, unless a particular locale was requested. -- cgit v1.2.3