[Pkg-javascript-commits] [dojo] 02/17: Check for legacy module in i18n sync require. Fixes #18448.

David Prévot taffit at moszumanska.debian.org
Thu Mar 24 04:28:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.7.9
in repository dojo.

commit b2b11e5636b5a81d5c185745d5593dd3519de406
Author: Clément Mathieu <clement.mathieu at outlook.com>
Date:   Mon Jan 26 15:41:33 2015 +0100

    Check for legacy module in i18n sync require. Fixes #18448.
---
 i18n.js | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/i18n.js b/i18n.js
index 183e7cb..627f1de 100644
--- a/i18n.js
+++ b/i18n.js
@@ -422,14 +422,16 @@ define(["./_base/kernel", "require", "./has", "./_base/array", "./_base/config",
 					if(cache[url]){
 						results.push(cache[url]);
 					}else{
-						var bundle= require.syncLoadNls(mid);
-						// don't need to check for legacy since syncLoadNls returns a module if the module
-						// (1) was already loaded, or (2) was in the cache. In case 1, if syncRequire is called
-						// from getLocalization --> load, then load will have called checkForLegacyModules() before
-						// calling syncRequire; if syncRequire is called from preloadLocalizations, then we
-						// don't care about checkForLegacyModules() because that will be done when a particular
-						// bundle is actually demanded. In case 2, checkForLegacyModules() is never relevant
-						// because cached modules are always v1.7+ built modules.
+						var bundle = require.syncLoadNls(mid);
+						// need to check for legacy module here because there might be a legacy module for a
+						// less specific locale (which was not looked up during the first checkForLegacyModules
+						// call in load()).
+						// Also need to reverse the locale and the module name in the mid because syncRequire
+						// deps parameters uses the AMD style package/nls/locale/module while legacy code uses
+						// package/nls/module/locale.
+						if(!bundle){
+							bundle = checkForLegacyModules(mid.replace(/nls\/([^\/]*)\/([^\/]*)$/, "nls/$2/$1"));
+						}
 						if(bundle){
 							results.push(bundle);
 						}else{

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list