06-22-2012 03:06 AM
I have implemented mutilingual functionality in my app.Now I just want to know can we change the language at runtime? by choosing as option from menu. The app which I implemented changed the language automitically when we change the language of device. So the same thing can we acheive on clicking a language option from menu?.
Please help me by giving your suggestions.
Thank you in advacne
Solved! Go to Solution.
06-22-2012 10:16 AM
This is pretty much where I thought you were anyway.
Your issue appears to be that the current screen is not updated. This makes sense. As I suggested, you should try restarting the Application and see if it works when you do that. If it does (and I'm confident it will), then the obvious thing to do is to recreate all screens when the user changes language. You are going to have to recreate them. There is unfortanutely no way you can tell the BlackBerry to do this for you.
06-23-2012 02:12 AM
The problem is your current screen not updating.
Then why dont you follow a mechanism like pop the current screen and push it again , mean while show some loader screen.
06-22-2012 05:08 AM
I've done this, but have not got the code handy. But look at the Locale class - setDefault() from memory. I think the user changed the language by updating a drop down in the App Options.
06-22-2012 05:34 AM
06-22-2012 06:00 AM
I presume you are using the localisation classes.
I would try setting the defalt Locale at app start-up. If this works, it does mean the user will ahve to restart the app to change language.
06-22-2012 06:30 AM
06-22-2012 07:15 AM
I also faced same problem,
I have solved my problem in the following way.
When the user wants change launguage I am showing a popup and the user can pick one language.
Now suppose the user selects arabic language,
I am setting the language like this.
_locale = Locale.get(Locale.LOCALE_ar);
From now onwards I am calling the services for arabic languages.
And I am displaying all the messages form Localization files so that all messsages are displayed in Arabic.
If you are not clear let me know.
06-22-2012 07:22 AM
06-22-2012 07:42 AM
Yes, I have already created three localization files for English, Spanish and Arabic. I did this by right clicking on the project New>Blackberry Resource Files> and then entered the file name with the extension .rrh and repeated the same steps by changing the extension .rrh to .rrc and for your Information my file names are MultiLingual_ar.rrc (Arabic), MultiLingual_es.rrc (Spanish) and MultiLingual_en.rrc (English). After creating this files I can able to add a key(Field Name) in one file and it is getting added to the remaining two files as well. then ofcourse I am using google translate to translate the languages and adding them in the value field of the .rrc files with respect to languages.
Now can you please help me how to achieve the required functionality that you already had accomplished.
If you can please help
06-22-2012 08:10 AM
Then , almost all completed,
Now you can do in this way.
One resource file will be created for your Localization, most likely your MultiLingunalResources(check for correct file name which is generated).
Now create resource bundle
ResourceBundle rb = ResourceBundle.getBundle( MultiLingualResources.BUNDLE_ID, MultiLingual.BUNDLE_NAME);
now you can use the labels in the following way.
There is no need to distinguish the language manually, the system will select appropriate language text.