Symbian Localization

Localtransformer supports Symbian localization. Localtransformer localizes Symbian .loc and .rls files. It is possible to localize Symbian applications using resource source files (.rss files). The resource files should be listed in the .mmp file. The key point is to avoid hard coding any strings in the .rss file.

For example if we have the following .rss file :

#include <eikon.rh>
#include <eikcore.rsg>
#include <appinfo.rh>
#include <avkon.rh>
#include <avkon.rsg>
#include "products.hrh"

#ifdef LANGUAGE_01
#include "products.rls"
#elif defined LANGUAGE_02
#include "de/products.rls"
#endif
RESOURCE RSS_SIGNATURE { }
RESOURCE MENU_BAR r_products_menubar
{
titles=
{
MENU_TITLE { menu_pane=r_products_menu; txt=STRING_r_products_menu; }
};
}
RESOURCE MENU_PANE r_products_menu
{
items=
{
MENU_ITEM { command=ESelect; txt=STRING_r_Select; },
2
MENU_ITEM { command=EOrder; txt=STRING_r_Order; },
MENU_ITEM { command=EPrice; txt=STRING_r_Price; },
MENU_ITEM { command=EExit; txt=STRING_r_Exit; }
};
}
RESOURCE TBUF r_welcome { buf=STRING_r_welcome; }
RESOURCE TBUF r_the_price_is { buf=STRING_r_the_price_is; }


The localized strings are contained in separate files. These are loaded by the .RSS file using the statements:

#ifdef LANGUAGE_01
#include "products.rls"
#elif defined LANGUAGE_02
#include "de/products.rls"
#endif

For example in German the .rls file products.rls will have the following contents:

rls_string STRING_r_products_menu "Produkte Menue"
rls_string STRING_r_Select "Waehlen"
rls_string STRING_r_Order "Kaufen"
rls_string STRING_r_Price "Preis"
rls_string STRING_r_Exit "Ausgang"
rls_string STRING_r_welcome "Willkommen beim Handy Katalog"
rls_string STRING_r_the_price_is "Der Preis ist :"

You can use literals in your code as follows:

HBufC * myLine = iEikonEnv->AllocReadResourceLC(r_welcome);
iLabel->SetTextL(*myLine);
CleanupStack::PopAndDestroy(myLine);

Or if it is desired to load the string into a class member:

TBuf<35> myLine;
iEikonEnv->ReadResource(myLine,r_welcome);

After the next compilation, you'll have two binary resource files: an .rsc file in English, and .r02 file, in German.The builder compiles the resource file once for each language code. On each compilation it defines a different preprocessor definition according of the following pattern: LANGUAGE_xx, where xx is the language code as specified in the .MMP file.
It is also necessary to modify the .pkg file so that it will let the user install your application in his desired language.

Removal of UTF-8 Header

Please also note that the .rls and .loc files will not work if the files contain a UTF-8 header. Localtransformer builds localized files without the UTF-8 and they will work.Other applications such as Notepad though will add a UTF-8 header by default on save

For more information consult the following websites :

http://developer.symbian.com/main/downloads/papers/symbianOSv9/LocalizingApplications.pdf
http://developer.symbian.com/main/downloads/papers/localizing_os/LocalizingApplications_v1.0.pdf
http://www.forum.nokia.com/main/resources/technologies/symbian/documentation/localization.html
http://www.newlc.com/Localization.html