Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 117
Registered: ‎02-12-2009
My Device: Not Specified
Accepted Solution

Steps for localizing BlackBerry Apps

Hi All,

 

I have gone through the developer guide for localizing applications. But its quite confused. I followed following steps

 

In BlackBerry JDE

 

1. I tried to create .rrc and .rrh file by Right Clicking on Project -> Create New File. But when i try to open that. I get error "Was expecting ; or .". I guess we cant create like that.

2. As the above option didnt work. I tried to create New Project -> Selected  type Language Resource -> Entered File name. We get .rrc and .rrh file (I can add key value here) with <project_name>Resources.java file (In which they explain how to use the bundle). But a interface in which BUNDLE_ID and BUNDLE_NAME etc are defined is not visible not sure why? (As mentioned by Johnathan Fisher in Localization Article) . I tried to create a screen in this project and use the resources. I am able to compile that. But that is not visible in downloads. Not sure if this is because of Project Type - Language resource.

3.Then I tried to decompile the Interface class file generated above and use in a HelloWorld project. Where i manually added the interface code to HelloWorld File. And then it worked. But if we have to manually add the interface code, then its not a good practice and automatically its not working in step 2.

 

In Eclipse with JDE Plugin.

 

1. I create New -> Other -> Resource File -> .rrc and .rrh file is created. I manually add the file for interface. It compiles successfully. But gives JVM 104 error (Resource Exception) while running in emulator. Not sure what is the problem.

 

So the steps are not clear. 

 

Anyone can please provide me clear steps how it should work. 

 

Thanks in advance,

Sandeep

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Steps for localizing BlackBerry Apps

you have to create a rrc and rrh file that matches your application name. if your app is names MyApp your files have to be MyApp.rrh and MyApp.rrc. If you add languages they have to be added with '_countrycode', for example MyApp_de.rrc

this is sufficient to work in the JDE. if you want to use the variables within eclipse (without the plugin) or another IDE you have to create a dummy interface called MyAppResource.java which contains a long BUNDLE_ID and a String BUNDLE_NAME. do NOT add this interface to your jde project, it is only used to publish the resources within the IDE.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 117
Registered: ‎02-12-2009
My Device: Not Specified

Re: Steps for localizing BlackBerry Apps

Hi Simon,

 

Thanks. I tried it and it worked in Eclipse and BlackBerry JDE Smiley Happy.

 

In Eclipse, I created New -> Other -> BlackBerry Resource File -> Selected Location under src/com/company i.e. where my source file of hello world project is located (File name same as project name as you mentioned). After doing this, if we check the JAR, it is automatically generating HelloWorldResource interface. And it works smoothly. So the only problem was i was not creating the resource file with application name. And here we dont have to create a seperate project for resourcebundle.

 

But in JDE, i have some doubt. We have to create a language resource project seperatly. I created a project LocalizationDemo (named resource file to HelloWorld) and in that it creates the HelloWorldResource interface. But i wanted to add the localization to HelloWorld project. I copied the .rrc, .rrh files to resource folder under HelloWorld poject and added them to project. And i had to add following import statement.

 

 

import com.infosys.LocalizationDemo.HelloWorldResource;

 

I checked the localizationdemo supplied in samples workspace in JDE. There they dont have any import statement and the Interface is in same project. So in this sample JDE localzation demo and Eclipse things work without import statements, but in newly created project I had to follow the above stated procedure. Not sure if this is fine. Ideally I thought I should be able to create resource file inside HelloWorld project instead of creating a seperate resource project.

 

Please provide your opinion on this.

 

Thanks and regards,

Sandeep

 

Highlighted
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Steps for localizing BlackBerry Apps

Does the package name for your resources match that of your application?  If it doesn't, you'll need to do an import as you describe.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 29
Registered: ‎04-01-2011
My Device: 9800
My Carrier: torch

Re: Steps for localizing BlackBerry Apps

Hi ,

    I have to implement the localization in my application,

    so please give me some guidence that from where I should start,If possible please send me some source code  and some important links.

 

Thanks in Advance..

 

Thanks
With Best Regards
Ashutosh Srivatava
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Steps for localizing BlackBerry Apps

please open your own thread for your question (the next time).
you can find the developer guides here:
http://docs.blackberry.com/en/developers/subcategories/?userType=21&category=Java+Development+Guides...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter