-
11 Jun 2012 3:39 AM #41Ext JS Premium Member
- Join Date
- Jan 2010
- Location
- Rotterdam, The Netherlands
- Posts
- 383
- Vote Rating
- 8
I'm done. My improvements:
- Allow for language change after language change after language change etc.
- Go back to original language using initialConfig
- Localizable grid values through column renderers!
- When components need tooltips, I usually add them as a tip property to the same component. That tooltip can be translated as well.
- Prevention against word wraps after translation that I have seen occuring.
- upgrade to latest build of SA (442)
- Use ExtJS from cdn.sencha.io
- renamed locale file to js, because IIS for example can't read .json files by default. (just to make it easy to test run this)
This is work in progress and needs further optimization. Specially in the area of configurability.
Check it out, improve it and update it on Git . I will too. Thanks.
https://github.com/devotis/Ext.ux.Localizer
-
11 Jun 2012 3:43 AM #42
Awesome!! As soon as I find a minute I'll check it out. Thanks!!
-
11 Jun 2012 4:28 AM #43
Excellent!
Regards.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
15 Dec 2012 8:46 AM #44
Hi, it's already been a little while since the last reply to this post but I'd like to share what I did in this regard (Localization) with my project.
I started referring to all the localizable strings by a variable name:
And then I created a file for every language in the application with the translations:Code:var header = Ext.create( 'Ext.TitleBar', { id: 'header', docked: 'top', title: titleName, cls: '', html: htmlHeaderContent });
Then in the html file I can either check the language of the browser, or create a language selection screen, and decide which file to load.Code://file eng_us.js var titleName="English title"; var htmlHeaderContent="Html content in English"; //file spa_es.js var titleName="Título español"; var htmlHeaderContent="Contenido en español";
I find this way pretty easy to use and maintain.
-
15 Dec 2012 11:28 AM #45
Hello,
the basic concept is quite good, but you are poluting the namespace by defining lots of global variables, this is not good. So I would recommend you the above posted solution using the Localizer.
Best regards,
RolandRoland Schütz
Senior Software Architect
---
Bancha Project - Seamless integrate CakePHP with ExtJS and Sencha Touch
-
15 Dec 2012 12:10 PM #46Ext JS Premium Member
- Join Date
- Jan 2010
- Location
- Rotterdam, The Netherlands
- Posts
- 383
- Vote Rating
- 8
The namespace pollution alone is not a valid argument to use Localizer. He might as well use Ext.translations.titleName="Título español";
Christiaan Westerbeek @ Devotis
STOIC ninja, Ext JS expert, Google Apps reseller, Marketing technologist
-
15 Dec 2012 12:14 PM #47
UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
15 Dec 2012 12:26 PM #48Ext JS Premium Member
- Join Date
- Jan 2010
- Location
- Rotterdam, The Netherlands
- Posts
- 383
- Vote Rating
- 8
Yes, I agree. I still use Localizer with projects I create with Sencha Architect today.
Christiaan Westerbeek @ Devotis
STOIC ninja, Ext JS expert, Google Apps reseller, Marketing technologist
-
15 Dec 2012 1:38 PM #49
Yeah, this is true. I keept my explanation a little short. I didn't wanted to specifically recommend Ext.ux.Localizer, I wanted to recommend the concept of a localizer.
I believe it's a more elegant way to have a text file which maps english strings to localized strings instead of using variables. This is a common an very successful pattern. You might want to look at gettext. There are many implementation of this in other languages, e.g. CakePHP has its implementation, and also JavaScript has multiple implementation, e.g. Jed.
Since I'm using CakePHP as a backend I have my own implementation in Bancha. I have a shell task which collects all translatable strings and writes them all in a pot file (A catalog of all translatable strings, supported by a lot of fancy translation tools). When I then open my WebApp the localizer pulls the correct language translations, afterwards each call of Banacha.t('Hello %s, good to see you', name) will be translated and returns the localized version.
Besides the advantage of having very readable code and having good tools to update and manage translations over time, I'm able to outsource specific translations.
Best regards,
RolandRoland Schütz
Senior Software Architect
---
Bancha Project - Seamless integrate CakePHP with ExtJS and Sencha Touch
-
17 Dec 2012 6:04 AM #50
Sencha Architect 2.2 (coming soon) will include a new feature called process config.
This allows you to integrate ideas like Localizer much more easily. More details to come from the author of this feature.Phil Strong
@philstrong
#SenchaArchitect
Sencha Architect Development Team


Reply With Quote