-
26 Sep 2011 12:58 AM #11
I successfully implemented my idea (with the current ExtJS locale files - but corrected, I had to remove the "Ext.onReady"). It works well, the only issue is that it executes the localization code too many times (more than necessary), but it's not enough to impact the performance anyways.
Is the ExtJS locale file fails for you every time you use it, or only during the build? It's maybe incomplete as well, but we can hope that one day Sencha will deliver a complete one. It's not our job do make those ones, is it? :p
About your idea now, I have a main issue. How would the LocaleLoader knows for which class it has to actually load the locale file? We can't possibly load for every single class in the framework.
-
29 Sep 2011 10:16 AM #12
So you have to modify the file anyway...
Well, my current "job" is to make the program work, since that's what my boss is asking.
However, since extjs4 is lacking this dynamic locale support, my intention is to contribute back the code, since it is open source GPL code.
Ultimately, that makes it our job
The existing locale file fails every time I try to use it with dynamic loading (as in including ext.js). If I use static loading (as in including ext-all.js like in the past with ext3) it works.
My guess is that sencha didn't touch locale files for ext3 -> ext4 transition - it is the same locale file used in ext3 so it can't work on the new class approach. It has to be changed anyway, I don't see why try to use it.
It is not just incomplete. It doesn't work.
It should use the name of the class being loaded:
- Some requirement of some user class asks for a ext class, (example: Ext.form.field.ComboBox)
- Existing ext loader code kicks in, loading the file based on the required class (example: it loads extjs/form/field/ComboBox.js)
- LocaleLoader would use the same information (name of the class) to load a locale text overwriter for that class only (if it exists) from the path locale/fr/form/field/ComboBox.js
When any undefined class is requested by some code, ext dynamic loader kicks in and loads that class javascript file based on a simple convention (Ext.foo.bar.Baz becomes extjs/foo/bar/Baz.js). My idea was to use the same convention to load the locale (locale/LANGUAGE_HERE/foo/bar/Baz.js).
-
29 Sep 2011 5:05 PM #13
-
3 Oct 2011 5:36 PM #14
-
3 Oct 2011 5:40 PM #15
-
3 Oct 2011 6:39 PM #16
Thanks,Whenever you are ready/publish it let me know i will download it from there.
Please correct me on this:
to get existing ExtJS classes. like the text on the grid column menu shows "Sort Ascending",
I just need to pass the value to extLocalePath in setLocale right?
For example:
Ext.Loader.setLocale({
enabled: true,
//This locale will be driven through the user input
language: Ext.getDom('locale-holder').getAttribute('locale'),
localizedByDefault: false,
extLocalePath:'/itm/include/ext-4.0.6/locale',
types: [ 'view' ]
});
-
3 Jan 2012 8:24 AM #17
Ext.util.Format.number throws a out of memory exception for german locale
Ext.util.Format.number throws a out of memory exception for german locale
Hi TigrouMeow,
I found an issue with the ext-locale-loader, So thought of to share with you,
When i used German locale( de), while using the Ext.util.Format.number , I got to see that the browser is throwing a out of memory exception, On debugging i found that it is happening at: ext-lang-de.js at the line
In the below shown code.Code:return Ext.util.Format.__number(v, format || "0.000,00/i");
So I commented out theCode:if(Ext.util.Format){ Ext.util.Format.__number = Ext.util.Format.number; Ext.util.Format.number = function(v, format) { return Ext.util.Format.__number(v, format || "0.000,00/i"); }; Ext.apply(Ext.util.Format, { thousandSeparator: '.', decimalSeparator: ',', currencySign: '\u20ac', // German Euro dateFormat: 'd.m.Y' }); }
As i did not see anything of these in fr locale though the "," is the decimal separator in Fr locale. Infact I did not see the above code piece anywhere other than German locale.Code:Ext.util.Format.__number = Ext.util.Format.number; Ext.util.Format.number = function(v, format) { return Ext.util.Format.__number(v, format || "0.000,00/i"); };
upon commenting the formatting was fine.
I created the same error with this sample code(cellediting.zip).
1. If you are using IE 8 you gonna see something like this. Out of Memory at line 5753.
2. The attached code has been implemented with MVC, with a ext-locale-loader.js, which loads the localized strings as been configured in app.js
something like this:
3. I am using Ext 4.0.6 in this example but the same issue is there in 4.0.7Code:Ext.Loader.setLocale({ enabled: true, language: 'de', localizedByDefault: false, extLocalePath:'/ext-4.0.6/locale', types: [ 'controller', 'view' ] });
4. Just for the test i have put a line in CellEditingController.js at line number 19:
Please let me know if you have more questions.Code:var formatednumber = Ext.util.Format.number(2.34, '0.0000');



Reply With Quote

