-
14 Jun 2010 8:35 AM #1
i18n / multi-lingual support
i18n / multi-lingual support
I have a big project coming that requires internationalization (i18n), only multi-language for now (nothing else about the cultures).
I would use the latest version of ExtJs, so I need an ExtJs (or compatible) solution that works fully on the client side, without any processing on the server but just loading language-specific javascript files (pre-generated in a certain format).
What would be the best approach in order to be able to change the text in all ExtJs widgets (labels, grid columns, buttons, etc.) when the user changes his language from a drop-down list?.
Is there anything already implemented for ExtJs to accomplish this?.
Thanks in advance,
Lobo
-
14 Jun 2010 2:29 PM #2
I usually create a class with a "msg" object that contains all the messages and text that I want to show in my components.
mymodule.js
When I want to select another language I just override the msg object including a file with the translations, like this:Code:var App.mymodule.Main = { msg : { title : "Welcome to this module", name : "Name", lastname :"Last Name", ....... }, init : function(){ var win = new Ext.Window({ title : this.msg.title, ....... }) win.show(); } }
mymodule-es.js
This file only contain the translationsCode:Ext.override(App.mymodule.Main,{ msg : { title : "Bienvenido a este modulo", name: "Nombre", lastname: "Apellido", ..... } });
I hope you can understand the main idea, my English is no so good
-
30 Nov 2012 5:13 AM #3
but how can you do that.
plz share the code.
-
12 Dec 2012 6:29 AM #4
Code:var myLocale = function(sid){ return myLocale.data[sid][myLocale.current]; }; myLocale.current = 0; myLocale.data = { 'sid0':['russianWord0','englishWord0'], 'sid1':['russianWord1','englishWord1'] ..... } var grid = Ext.create('Ext.grid.Panel',{ 'columns':[ {'text':myLocale('sid0')}, {'text':myLocale('sid1')} ] })
Similar Threads
-
[INFOREQ] Bug Multi-language support.
By edward in forum Ext Designer: BugsReplies: 4Last Post: 5 Apr 2010, 3:55 AM -
Multi-sort support
By leonate in forum Community DiscussionReplies: 5Last Post: 26 Aug 2008, 5:11 PM -
Support for Multi Column Sorting in Grid?
By sethladd in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 24 Dec 2007, 3:44 PM


Reply With Quote