| 1 |
define(function() { |
| 2 |
var nlsRe= |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/; |
| 11 |
|
| 12 |
return { |
| 13 |
start:function( |
| 14 |
mid, |
| 15 |
referenceModule, |
| 16 |
bc |
| 17 |
){ |
| 18 |
var i18nPlugin = bc.amdResources["dojo/i18n"], |
| 19 |
match = nlsRe.exec(mid), |
| 20 |
bundleName = match[5] || match[4], |
| 21 |
bundlePath = bc.getSrcModuleInfo(match[1] + bundleName, referenceModule).mid.match(/(.+\/)[^\/]+/)[1], |
| 22 |
locale = (match[5] && match[4]), |
| 23 |
i18nResourceMid = bundlePath + (locale ? locale + "/" : "") + bundleName, |
| 24 |
i18nResource = bc.amdResources[i18nResourceMid]; |
| 25 |
|
| 26 |
if(!i18nPlugin){ |
| 27 |
throw new Error("i18n! plugin missing"); |
| 28 |
} |
| 29 |
if(!i18nResource){ |
| 30 |
throw new Error("i18n resource (" + i18nResourceMid + ") missing"); |
| 31 |
} |
| 32 |
return [i18nPlugin, i18nResource]; |
| 33 |
} |
| 34 |
}; |
| 35 |
}); |