Opened 7 years ago
Last modified 3 years ago
#17538 assigned defect
[patch] Locale not being set in Windows 8.1
Reported by: | rgillan | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.15 |
Component: | Internationalization | Version: | 1.9.1 |
Keywords: | Cc: | Clement Mathieu | |
Blocked By: | Blocking: |
Description
Dojo is not detecting the locale at startup under Windows 8.1. It is likely due to the OS being responsible for the locale (rather than the browser) although we are unsure as to how to get around it. It is throwing an error:
0x800a138f - JavaScript? runtime error: Unable to set property '$locale' of undefined or null reference
When we run the non minified codebase it seems to be being thrown from:
current.$locale = availableLocales.specificity;
Change History (23)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
Are you talking about making a Windows Metro app, or IE11? I did some work towards support metro apps in #16432 but it was never finished.
comment:3 Changed 7 years ago by
So we've been able to trap some errors in i18n.js. The doLoad function, specifically
require([bundlePathAndName], function(root){
has root passed as a number (3) for bundlePathAndName of dojo/cldr/nls/gregorian and dojo/cldr/nls/number. For the three other calls (dojox/calendar/nls/button, dijit/form/nls/ComboBox, dijit/form/nls/validate) the root is valid, and hence the current = lang.clone(root.root) returns the contents of the nls root object as expected. For the two (both interestingly under dojo/cldr) that pass the number 3 then obviously current is undefined. We do not know why this is not reporting correctly, as all of the files exist in our build (double checked) and are the same on iOS and Android builds.
To allow our code porting to progress further, we have simply matched the bundlePathAndName to the two incorrect paths, and manually set current = {..} from the contents of the respective nls files and the errors are cleared.
comment:4 Changed 7 years ago by
Cc: | Clement Mathieu added |
---|
comment:5 Changed 7 years ago by
Our app is being reported dead on windows 8.1, the calendar widget just dies completely. Will there be a patch for 1.8 versions of dojo on this one? thanks guys
comment:6 Changed 7 years ago by
httpete, by Windows 8.1 you mean running on IE11? And which calendar widget are you talking about? (we have several ones)
comment:7 Changed 7 years ago by
We are seeing this even on Chrome Windows 8.1. I made a custom calendar widget off of the dijit/Calendar, but it is near identical in its use of i18n bundles.
comment:8 Changed 7 years ago by
Gents, I apologize, I upgraded to 8.1 and this is working ok for me in chrome. I have a screen capture from one of our users and somehow it is failing for him. I have seen i18n issues do exactly what his screen cap shows. I will continue to investigate and let you know if I am able to see it. The user stated that this started after his 8.1 upgrade.
comment:9 Changed 7 years ago by
Owner: | set to rgillan |
---|---|
Status: | new → pending |
OK, I guess we should close this and then reopen if you get a test case that's failing. I'm setting it to close in 2 weeks if there's no reponse.
comment:10 Changed 7 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
comment:11 Changed 7 years ago by
We are developing a windows 8.1 app and we are using dojo's Globalization (i18n) framework. We are also experiencing the same issue and unable to start the app on windows 8.1. The app uses in-build IE11 browser.
comment:12 Changed 7 years ago by
I am unable to reopen the ticket. Can somebody open it again. Thanks.
comment:13 Changed 7 years ago by
Hi,
Could you provide a test case so we can reproduce the bug to investigate ?
Thanks.
comment:14 Changed 7 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:15 Changed 7 years ago by
Status: | reopened → pending |
---|
comment:16 Changed 7 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
comment:17 Changed 5 years ago by
This does still happen for me in simple phonegap/worklight projects that use dojo's 1.9.3 require to try and load bundles on a non-English Windows 8.1 tablet.
This is the line in dojo.js that fails... root.root always returns null. It appears that on Windows tablets, this require doesn't return the root bundle, it returns the specific language bundle, no there's no available locales, and no root.root that exists.
require([bundlePathAndName], function(root){
var current = lang.clone(root.root root.ROOT), 1.6 built bundle defined ROOT availableLocales = getAvailableLocales(!root._v1x && root, locale, bundlePath, bundleName);
require(availableLocales, function(){
for (var i = 1; i<availableLocales.length; i++){
current = lang.mixin(lang.clone(current), arguments[i]);
} target may not have been resolve (e.g., maybe only "fr" exists when "fr-ca" was requested) var target = bundlePathAndName + "/" + locale; cache[target] = current; current.$locale = availableLocales.specificity; load();
});
});
comment:18 Changed 5 years ago by
In later builds than 1.9.3, (1.9.7 and 1.10.x), it appears this code is moved to i18n.js.
I fixed this in my local build by making this change in dojo.js or i18n.js.
require([bundlePathAndName], function(root){
var current = root.root === undefined ? root : lang.clone(root.root root.ROOT), 1.6 built bundle defined ROOT
comment:19 Changed 5 years ago by
Component: | General → Internationalization |
---|---|
Milestone: | tbd → 1.12 |
Resolution: | invalid |
Status: | closed → reopened |
Summary: | Locale not being set in Windows 8.1 → [patch] Locale not being set in Windows 8.1 |
comment:20 Changed 5 years ago by
Owner: | rgillan deleted |
---|---|
Status: | reopened → assigned |
comment:22 Changed 4 years ago by
Milestone: | 1.13 → 1.15 |
---|
Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.
comment:23 Changed 3 years ago by
I have exactly the same problem with an application (dojo 1.13) which works fine in a browser, works fine when embedded in Electron or NW.js ... but does not work at all when embedded in an Universal Windows App: dojo/cldr/nls/number and gregorian are not loaded properly, root contains the number 3 in the callback of require([bundlePathAndName], function(root) { } (i18n.js, doLoad function).
I've used the same inelegant workaround as rgillan, that's to say modify i18n.js in this way:
doLoad = function(require, bundlePathAndName, bundlePath, bundleName, locale, load){ require([bundlePathAndName], function(root){ if (root == 3) { switch(bundlePathAndName) { case "dojo/cldr/nls/number": root = { /* contents of cldr/nls/number.js */ } break; case "dojo/cldr/nls/gregorian": root = { /* contents of cldr/nls/gregorian.js */ } break; } } var current = !root.root ? lang.clone(root) : lang.clone(root.root || root.ROOT), availableLocales = getAvailableLocales(!root._v1x && root, locale, bundlePath, bundleName); // and so on...... } }
We have tried to debug around the doLoad function on i18n.js and are seeing something interesting. There are 5 entries in the nls/dojo_ROOT:
define('dojo/nls/dojo_ROOT',{ 'dijit/form/nls/ComboBox':{"previousMessage":"Previous choices","nextMessage":"More choices"} , 'dojo/cldr/nls/gregorian':{"days-standAlone-short""Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months-format-narrow""1","2","3","4","5","6","7","8","9","10","11","12"],"quarters-standAlone-narrow""1","2","3","4"],"field-weekday":"Day of the Week","dateFormatItem-yQQQ":"y QQQ","dateFormatItem-yMEd":"y-MM-dd, E","dateFormatItem-GyMMMEd":"G y MMM d, E","dateFormatItem-MMMEd":"MMM d, E","eraNarrow""BCE","CE"],"days-format-short""Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateTimeFormats-appendItem-Day-Of-Week":"{0} {1}","dateFormat-long":"y MMMM d","months-format-wide""Month1","Month2","Month3","Month4","Month5","Month6","Month7","Month8","Month9","Month10","Month11","Month12"],"dateTimeFormat-medium":"{1} {0}","dayPeriods-format-wide-pm":"PM","dateFormat-full":"y MMMM d, EEEE","dateFormatItem-Md":"MM-dd","dayPeriods-format-abbr-am":"AM","dateTimeFormats-appendItem-Second":"{0} ({2}: {1})","dateFormatItem-yMd":"y-MM-dd","field-era":"Era","dateFormatItem-yM":"y-MM","months-standAlone-wide""Month1","Month2","Month3","Month4","Month5","Month6","Month7","Month8","Month9","Month10","Month11","Month12"],"timeFormat-short":"HH:mm","quarters-format-wide""Q1","Q2","Q3","Q4"],"dateFormatItem-yQQQQ":"y QQQQ","timeFormat-long":"HH:mm:ss z","field-year":"Year","dateFormatItem-yMMM":"y MMM","dateTimeFormats-appendItem-Era":"{1} {0}","field-hour":"Hour","months-format-abbr":["Month1","Month2","Month3","Month4","Month5","Month6","Month7","Month8","Month9","Month10","Month11","Month12"],"timeFormat-full":"HH:mm:ss zzzz","dateTimeFormats-appendItem-Week":"{0} ({2}: {1})","field-day-relative+0":"Today","field-day-relative+1":"Tomorrow","dateFormatItem-GyMMMd":"G y MMM d","dateFormatItem-H":"HH","months-standAlone-abbr":["Month1","Month2","Month3","Month4","Month5","Month6","Month7","Month8","Month9","Month10","Month11","Month12"],"quarters-format-abbr":["Q1","Q2","Q3","Q4"],"quarters-standAlone-wide":["Q1","Q2","Q3","Q4"],"dateFormatItem-Gy":"G y","dateFormatItem-M":"L","days-standAlone-wide":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"timeFormat-medium":"HH:mm:ss","dateFormatItem-Hm":"HH:mm","quarters-standAlone-abbr":["Q1","Q2","Q3","Q4"],"eraAbbr":["BCE","CE"],"field-minute":"Minute","field-dayperiod":"Dayperiod","days-standAlone-abbr":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateFormatItem-d":"d","dateFormatItem-ms":"mm:ss","quarters-format-narrow":["1","2","3","4"],"field-day-relative+-1":"Yesterday","dateFormatItem-h":"h a","dateTimeFormat-long":"{1} {0}","dayPeriods-format-narrow-am":"AM","dateFormatItem-MMMd":"MMM d","dateFormatItem-MEd":"MM-dd, E","dateTimeFormat-full":"{1} {0}","field-day":"Day","days-format-wide":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"field-zone":"Zone","dateTimeFormats-appendItem-Day":"{0} ({2}: {1})","dateFormatItem-y":"y","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12"],"dateFormatItem-hm":"h:mm a","dateTimeFormats-appendItem-Year":"{1} {0}","dateTimeFormats-appendItem-Hour":"{0} ({2}: {1})","dayPeriods-format-abbr-pm":"PM","days-format-abbr":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"eraNames":["BCE","CE"],"dateFormatItem-yMMMd":"y MMM d","days-format-narrow":["S","M","T","W","T","F","S"],"days-standAlone-narrow":["S","M","T","W","T","F","S"],"dateFormatItem-MMM":"LLL","field-month":"Month","dateTimeFormats-appendItem-Quarter":"{0} ({2}: {1})","dayPeriods-format-wide-am":"AM","dateTimeFormats-appendItem-Month":"{0} ({2}: {1})","dateTimeFormats-appendItem-Minute":"{0} ({2}: {1})","dateFormat-short":"y-MM-dd","field-second":"Second","dateFormatItem-yMMMEd":"y MMM d, E","dateFormatItem-Ed":"d, E","dateTimeFormats-appendItem-Timezone":"{0} {1}","field-week":"Week","dateFormat-medium":"y MMM d","dayPeriods-format-narrow-pm":"PM","dateTimeFormat-short":"{1} {0}","dateFormatItem-Hms":"HH:mm:ss","dateFormatItem-hms":"h:mm:ss a","dateFormatItem-GyMMM":"G y MMM"} , 'dojox/calendar/nls/buttons':{"previousButton":"◄","nextButton":"►","todayButton":"Today","dayButton":"Day","weekButton":"Week","fourDaysButton":"4 Days","monthButton":"Month"} , 'dojo/cldr/nls/number':{"scientificFormat":"#E0","currencySpacing-afterCurrency-currencyMatch":"[:S:]","infinity":"∞","list":";","percentSign":"%","minusSign":"-","currencySpacing-beforeCurrency-surroundingMatch":"[:digit:]","decimalFormat-short":"000T","currencySpacing-afterCurrency-insertBetween":" ","nan":"NaN","plusSign":"+","currencySpacing-afterCurrency-surroundingMatch":"[:digit:]","currencySpacing-beforeCurrency-currencyMatch":"[:S:]","currencyFormat":"¤ #,##0.00","perMille":"‰","group":",","percentFormat":"#,##0%","decimalFormat-long":"000T","decimalFormat":"#,##0.###","decimal":".","currencySpacing-beforeCurrency-insertBetween":" ","exponential":"E"} , 'dijit/form/nls/validate':{"invalidMessage":"The value entered is not valid.","missingMessage":"This value is required.","rangeMessage":"This value is out of range."} });
When doLoad is called, it seems that 2 of the 5 are not cloned and leave current as undefined:
before clone - root.root:undefined:undefined after clone - current:undefined:undefined before clone - root.root:object:{"previousMessage":"Previous choices","nextMessage":"More choices"} after clone - current:object:{"previousMessage":"Previous choices","nextMessage":"More choices"} before clone - root.root:object:{"invalidMessage":"The value entered is not valid.","missingMessage":"This value is required.","rangeMessage":"This value is out of range."} after clone - current:object:{"invalidMessage":"The value entered is not valid.","missingMessage":"This value is required.","rangeMessage":"This value is out of range."} before clone - root.root:undefined:undefined after clone - current:undefined:undefined before clone - root.root:object:{"previousButton":"◄","nextButton":"►","todayButton":"Today","dayButton":"Day","weekButton":"Week","fourDaysButton":"4 Days","monthButton":"Month"} after clone - current:object:{"previousButton":"◄","nextButton":"►","todayButton":"Today","dayButton":"Day","weekButton":"Week","fourDaysButton":"4 Days","monthButton":"Month"}
looking like nls/gregorian and nls/number are throwing an undefined error. We have verified that these are in the build. The only way to get past the issue (for now) has been to add
if (current === undefined) {current = {};}
after the lang.clone.