How to add resource file to provide multi lingual support

Posted on August 28, 2009. Filed under: software development |

 

To reach the widest audience for your application you want to provide support for many different languages and cultures.  This process is known as internationalization.  The most common way of achieving this goal is through resource files for the different target languages (or cultures).

The first step to using resources is to add the resource files to your application (of course this is for the Blackberry plugin for Eclipse).

  1. open the package explorer and find your source package
  2. from the context menu (right-click) OR file->new, select Other [you can also use ctrl-N]
  3. open up the blackberry folder and select ‘Blackberry Resource File’
  4. click next
  5. Select the folder where you wish to save the file.  Generally you want to include it with your source code.
  6. type in the name of your resource file ‘applicationName.rrh’ .  IMPORTANT: the file must end with rrh.
  7. you will see that you have two files:  applicationName.rrh and applicationName.rrc.  the RRH file defines the symbols for each of your strings, and the RRC contains the strings.
  8. add in a file for each culture that you wish to include using the format: applicationName_xxx.rrc.  You must replace xxx with the culture abbreviation and you need the underscore
  9. You have now created your files.  Click on the files and start editing to your heart content.

Some of the common cultures:

Language neutral culture abbreviation
English en
French fr
spanish es
Chinese zh
Japanese ja

Culture definitions:

invariant culture This culture category is culture-insensitive. The category is to be used as essentially a default culture when consistency is desired.

One situation where this category might be desirable to use is creating a trial application with a hard-coded expiration date. Using an invariant will allow you to check for a specific date, regardless of the culture’s format, which will greatly simplify the task of comparing these dates.

The invariant culture is not based on the English language per se, but it is associated with it and bears more similarities to it than to any other identifiable culture.

Neutral Culture A neutral culture is associated with a language but has no relationship to countries or regions. For instance, the English spoken in England is different from that spoken in the United States. The same holds true for Spanish spoken in Mexico versus that spoken in Spain.

Although neutral cultures, like the invariant culture, might be tempting to use, they should be avoided as well, if possible, for the same reasons that invariants should be avoided. The language spoken in different countries that are covered by a neutral culture will almost certainly be different in at least a few respects. In reality, the differences will be many.

Specific Culture This is the most precise of the three categories and is represented by a neutral culture, a hyphen, and then a specific culture abbreviation. For instance, in the designations "en-CA" and "en-US", en represent the neutral culture (English), and CA and US represent the specific culture (Canada and the United States, respectively).
Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

One Response to “How to add resource file to provide multi lingual support”

RSS Feed for Michael’s Weblog Comments RSS Feed

[…] a previous post I gave the steps on how to add resource files to your application.  In today’s discourse I […]


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: