Hello all, I am using Pivot for about a month now and until now I was able to do everything I needed to, but now I am facing an issue that I don’t know how to solve: I need to implement a dynamic localization in my application, meaning the user must be able to click on a button in some kind of toolbar and the UI must change directly to display all texts in the chosen language without restarting the application. I looked at the localization example of the pivot tutorial, but it seemed that this feature does not provide the level of dynamicity that I need. Then I used the data binding feature: by setting the textKey property of all the labels in my UI I am able, when the user click on the button to change the display language, to build a dictionary containing the new translation and update all displayed text with the load() method. That works pretty well except that a lot of texts in my UI are not bindable, like the TabHeader, Border title or Button text (only buttonData is bindable, so I cannot use data binding to change only the text in the case I want to diplay an icon and a text in the button). A solution could be to use data binding where possible (mainly for labels) and to write some specific code to handle TabHeader, Border title etc. But I would prefer to avoid writing specific code. So I go back to the localization feature and found on the mailing list the question of Joao Neves, and the answer of Greg Brown saying >If you define your UI in BXML, you can just reload it after you change the locale. That seems interesting but I do not understand how to “reload the UI”; if someone could post a little code snippet showing how to do that, that would be great. Or if anybody has another suggestion on how to implement this dynamic localization, I would be also very interested.
Thank you Simon On Wed, Dec 15, 2010 at 6:26 PM, Greg Brown <[email protected]> wrote: > If you define your UI in BXML, you can just reload it after you change the > locale. > > On Dec 15, 2010, at 12:04 PM, João Neves wrote: > > > Thanks, somehow I missed that method. > > > > So there is no "automagic" way to update the UI, and I'll have to > > change the text in all elements "manually", correct? > > > > Thanks once again for your help. > > > > -- > > João Neves > > > > > > > > On Wed, Dec 15, 2010 at 16:56, Greg Brown <[email protected]> wrote: > >> Yes - you can call Locale.setDefault(). However, your UI won't > automatically update itself. You'll need to handle this yourself. > >> > >> On Dec 15, 2010, at 11:47 AM, João Neves wrote: > >> > >>> Hi, > >>> > >>> Is it possible to change the application locale after it started? > >>> > >>> Thanks! > >>> > >>> -- > >>> João Neves > >> > >> > >
