Guys,
Here you can find my solution for i18n using .properties files (ala Java) Hope you can find this useful!
http://elmasse.gaver.nl/index.php/bl...-touch-bundles
Regards!
Max
Printable View
Guys,
Here you can find my solution for i18n using .properties files (ala Java) Hope you can find this useful!
http://elmasse.gaver.nl/index.php/bl...-touch-bundles
Regards!
Max
This is an interesting approach. I do something similar in the post below, the difference being I use js objects to store values instead of properties files:
http://www.sencha.com/forum/showthre...d-Localization
Eventually I would like to get a response from the Sencha Touch crew to see if they have an officially sanctioned way to do I18N. An API from them would be awesome ... but I haven't heard anything about that.
It seems that link is private.
I too would love for Sencha to offer an official path.
AFAIK, Sencha or ExtJS has a way to do i18n by loading .js files that override variables used to represent text.
This solution doesn't aim to replace that methodology but it comes to solve a common issue when you work with Java code in backend. At the time I started this component I was working with a lot of Java and I needed to re-use or integrate its i18n solution in order to not have multiple path to the same way.
Despite of that, I believe that we need a better strategy for i18n but that is a different topic.
Here is the content from the above link that does not work for non-premium members.
Hi,
My app has content that is being localized, and I am curious if there is a suggested approach for an I18N implementation. I have an idea about what could be done, but would like to know if I'm doing it all wrong.
Basically I need all the localized resources before the app is initialized, so they can be used as component configuration values. To do this, I do something like
To clarify, Localization is not an existing object. It is created in my code before my app is launched, and contains logic to get the correct strings based on browser locale. Then in the app I can do things like:Code:Localization.onReady(startApp())
I can use the global navigator object to detect browser locale and get the right strings that way, so no worries there.Code:var myButton = new Ext.Button({text: Localization.getLocalizedString('mybuttonresourcekey')});
Is this the right approach? I'm mostly questioning the way I use the Localization.onReady before Ext.onReady to start the app. Thanks for any advice you can lend, or documentation you can point me to.
Brien
Brien,
This is an oldie but it is how i18n is proposed from ExtJS devs point of view:
http://www.sencha.com/learn/legacy/Tutorial:Localizing_Ext
This is some kind of workaround. You can override your localized variables by js code. In this example, when you change or select a different language, a new .js file is loaded and its content will override your already defined variables.
Hello,
I'm struggling for a week now on internationalizing my application. I tried above hints and tips, but my situation is each time slightly different so it's difficult to find the correct solution.
I'm creating an application with Phonegap, so I can not make use of server things. Everything needs to be in Javascript.
I tried the Ext way of doing i18n, but the problem is that I can't find how to refresh the page so that it is using the new values. Should I destroy everything and load it again? In the beginning all my panels were created with ... = new ..., but I already changed that to classes to call the initComponent method. Creating all the panels again is a lot of work because I have a lot of panels.
I also tried it with a seperate object in which the strings are, but again, the strings are refreshed in this object but I can't find out how to refresh them in the panels.
Thanks already for your hints and tips. it already helped me a lot.
Jolien
Hi again,
I just tried to call the initComponent methods, and that is changing the values but it still doesn't refresh the rendered html. is there some kind of render method you can call manually?
Hi,
I got it working by destroying my viewport and creating it again. This loads all the panels again with the correct language and renders them again. It happens without flickering for the user.