How to add multi-language support to the Symbian C ++ Program

Source: Internet
Author: User

Development Environment: s60_3rd_fp2 SDK/carbide C ++ 1.3.2

Step 1: write local content

Add the content to be supported by language in the project.CodeFor example, the simplified Chinese is 31, and the German is 03. Create a file that stores local strings, such as Hakone. L31 and Hakone. l03.

Hakone. L31:

Code
/* -----------------------------------------------------------------
Language Support for Chinese
------------------------------------------------------------------ */
# Define Qtn_caption_string "hakone_s60"

# DefineQtn_connect "connection"
# DefineQtn_disconnect "disconnected"
# DefineQtn_setting "setting"
# DefineQtn_about "about"
# DefineQtn_exit "quit"

After defining the support files for various languages, you need to add a. Loc file to select the Supported languages, such as Hakone. loc.

Code
Character_set utf8

//Default language
# Ifdef language_ SC
# Include"Localization \ Hakone. L01"
# Endif

//English (UK)
# Ifdef required age_01
# Include"Localization \ Hakone. L01"
# Endif

//Simplified Chinese
# Ifdef language_31
# Include"Localization \ Hakone. L31"
# Endif

These files can be stored in any include directory. We recommend that you design the storage location properly.

Step 2: Use related multilingual definitions in the RSS File

For example, Hakone. RSS:

Code
# Include " Hakone. Loc "

//
// Some content here
//

Resource menu_pane r_hakone_main_menu
{
Items =
{
// Added the new options menu command here
Menu_item
{
Command = Emainviewconnect;
Txt = Qtn_connect;
},
Menu_item
{
Command = Emainviewdisconnect;
Txt = Qtn_disconnect;
},
Menu_item
{
Command = Emainviewsettings;
Txt = Qtn_setting;
},
Menu_item
{
Command = Emainviewabout;
Txt = Qtn_about;
},
Menu_item
{
Command = Eaknsoftkeyexit;
Txt = Qtn_exit;
}
};
}

 

Step 3: update the MPs File

You can use the carbide ide to upgrade the MPs file or manually add multi-language support:

For example, add Hakone. MPP to the following code:

Lang 01 31

Step 4: update the PKG File

You need to add the multi-language file option to the package file. Because the first file compiled by Hakone. L31 is Hakone. R31, add the following code to the Hakone. PKG file:

{
" $ (Epocroot) epoc32 \ data \ Z \ resource \ apps \ hakone_s60.r01 "
" $ (Epocroot) epoc32 \ data \ Z \ resource \ apps \ hakone_s60.r31 "
} -   " ! : \ Resource \ apps \ hakone_s60.rsc "

The Code shows thatProgramDuring installation, the system automatically selects different languages to update the resource file hakone_s60.rsc of the application. When the application calls the RSC file to read strings, the content in different languages can be obtained.

Summary:

In this way, you can implement multi-language applications. When installing a program, you will be prompted to select the supported language for installation. At the same time, if you want the program to support different languages at runtime. copy the rxx file to the system so that the application can call different. rxx file.

PS:

Starting with 5800 machines today, although I know it is definitely not as good as n97, I am still looking forward to it. After all, is it the first s60 5th? In an economic crisis, this big advertisement mobile phone has already bought about 2000 yuan, it's cool to combine Nokia's performance in the first quarter...

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.