Localize the uiq3 program during development
Translated from official uiq3 development documents;
LocalizingApplications-part3_v1.1.pdf version 1.1
Translator: yzhv @ ioicn
You are welcome to reprint it. Please indicate the source author.
Localize the uiq3 program during development
1. Introduction
The release of Symbian OS V9 is a significant watershed. The system introduces an enhanced security architecture. The security model also leads to changes in the program structure, so the structure and location of the program resource file have also changed. Security Platform details andSoftwareSee "Symbian OS platform security" by Craig Heath (Wiley 2006 ).
This article mainly introduces some changes related to the localization process. Fortunately, these changes are very small and some basic principles in uiq2 are still valid.
2. Software Localization
First, take a look at the (uiq). MMP file:
Sourcepath.
Source helloworld_main.cpp
Source helloworld_application.cpp
Source helloworld_document.cpp
Source helloworld_appui.cpp
Source helloworld_appview.cpp
Userinclude.
Systeminclude/epoc32/include
Start resource helloworld. RSS
Header
Targetpath/resource/apps
Lang 01 02
End
Start resource helloworld_reg.rss
# Ifdef winscw
Targetpath/private/10003a3f/apps
# Else
Targetpath/private/10003a3f/import/apps
# Endif
End
Start resource helloworld_loc.rss
Targetpath/resource/apps
Lang 01 02
End
Library euser. Lib, apparc. Lib, cone. Lib, eikcore. Lib
Library qikctl. Lib eikctl. Lib qikcore. Lib qikutils. Lib qikdlg. Lib
In Symbian V9, changes to the. MMP file are mainly related to the resource syntax, for example
The header keyword is optional. This keyword causes the system to include directories... /Epoc32/include generates a resource header file (. RSG ).
Targetpath defines the (. RSC) storage location after the resource file is compiled. In Symbian OS V9, data caging (a part of the platform security architecture) requires that resources be placed in the correct path, either a public read-only directory/resource, either the/private/<secure_id> directory of the private resources of the stored program, and <secure_id> is the uid3.
The meaning of Lang is the same as that of uiq2.xx. Therefore, in the preceding example, the resource compilation is executed twice in each language.
3. localized program resources
Take a look at the content of the. RSS file. For the uiq user interface:
Resource eik_app_info
{
Hotkeys = r_example_hotkeys;
Menubar = r_example_menubar;
}
Resource hotkeys r_example_hotkeys
{
Control =
{
Hotkey {command = eeikcmdexit; Key = 'E ';}
};
}
Resource menu_bar r_example_menubar
{
Titles =
{
Menu_title {menu_pane = r_example_first_menu; TXT = string_r_example_first_menu ;}
};
}
Resource menu_pane r_example_first_menu
{
Items =
{
Menu_item {command = eexampleitem0; TXT = string_r_example_item0 ;},
Menu_item {command = eexampleitem1; TXT = string_r_example_item1 ;},
Menu_item {command = eexampleitem2; TXT = string_r_example_item2 ;},
Menu_item {command = eeikcmdexit; TXT = string_r_example_close ;}
};
}
Resource tbuf r_example_text_hello {Buf = string_r_example_text_hello ;}
Resource tbuf r_example_text_item0 {Buf = string_r_example_item0 ;}
Resource tbuf r_example_text_item1 {Buf = string_r_example_item1 ;}
Resource tbuf r_example_text_item2 {Buf = string_r_example_item2 ;}
Similar to versions earlier than V9, use conditional inclusion to reference. RLS:
3.1 localized resource string
A file that contains a localized string has the same file name as the program name. The suffix uses the _ LXX extension, and XX is the language number. These files are loaded by the. RSS file using the following statement:
4. Program registration file
Another major change in V9 is the program registration file. The GUI program is now a. EXE file (before V9 is A. app file). The program registration file is used to tell the application architecture that this. EXE is a GUI program. Let's take a look at the following structure of the MPs file:
The program registration file name is the same as the program name. The _ reg suffix is added to replace the AIF file supported by uiq2.x. These registration files must be placed in the private data caged directory, owned by the application architecture server, which is responsible for the software startup and loading process. Put the _ reg file into a private directory to prevent malicious users from forging or replacing the _ reg file of the program. The content of the program registration file is as follows:
The app_registration_info structure uses the app_file Declaration to provide the file name of the binary file (excluding the extension ). If you provide localized icons/titles, you must provide the complete file path (like in the preceding example), except for the drive letter and extension. This file defines the program title and icon file. The file name is usually the same as the program name, but the _ loc suffix is used.
The helloworld_loc.rss file is a standard Symbian localization resource file. It is included in the program's. MMP file and compiled by the resource compiler:
5. Installation of localization programs
The last step in the localization process is to create the installation package (. SIS) file. You can install the installation package based on the language of the phone device. The PKG file of the hello World Program is as follows:
"/Symbian/uiq3sdk/epoc32/release/armv5/urel/helloworld_uiq.exe "-"! :/Sys/bin/helloworld_uiq.exe"
"/Symbian/uiq3sdk/epoc32/data/z/private/10003a3f/apps/helloworld_reg.rsc "-"! :/Private/10003a3f/import/apps/helloworld_reg.rsc"
{"/Symbian/uiq3sdk/epoc32/data/z/resource/apps/helloworld. R01"
"/Symbian/uiq3sdk/epoc32/data/z/resource/apps/helloworld. r02"
}-"! :/Resource/apps/helloworld. RSC"
{"/Symbian/uiq3sdk/epoc32/data/z/resource/apps/helloworld_loc.r01"
"/Symbian/uiq3sdk/epoc32/data/z/resource/apps/helloworld_loc.r02"
}-"! :/Resource/apps/helloworld_loc.rsc"
Quote:
// Helloworld. MMP
Target helloworld.exe
Targettype exe
UID 0x100039ce 0xe0000003
Quote:
Start resource helloworld. RSS
Header
Targetpath/resource/apps
Lang 01 02
End
Each. RSS file defines a resource block, starting with start and ending with end.
Quote:
Name hewo
# Include <Eikon. RH>
# Include <eikcore. RSG>
# Include <appinfo. RH>
# Include "helloworld. HRH"
# Ifdef required age_01
# Include "helloworld. L01"
# Elif defined then age_02
# Include "helloworld. L02"
# Endif
Resource rss_signature {}
Resource tbuf r_default_document_name
{
Buf = "hewo ";
}
Quote:
# Ifdef required age_01
# Include "01-strings.rls"
# Else if defined then age_02
# Include "02-strings.rls"
# Endif
Quote:
# Ifdef required age_01
# Include "helloworld. L01"
# Elif defined then age_02
# Include "helloworld. L02"
# Endif
The content of helloworld. L02 is as follows, which contains the string resource of the language 02 (France.
Quote:
// Strings localized for France
Rls_string string_r_example_first_menu "bonjour"
Rls_string string_r_example_item0 "é l é ment 0"
Rls_string string_r_example_item1 "é l é ment 1"
Rls_string string_r_example_item2 "é l é ment 2"
Rls_string string_r_example_close "fin"
Rls_string string_r_example_text_hello "Bonjour monde! "
Rls_string string_r_example_short_caption "B M"
Rls_string string_r_example_caption "Bonjour tout le monde"
Quote:
Start resource helloworld_reg.rss
Targetpath/private/10003a3f/apps
End
Quote:
# Include <appinfo. RH>
Uid2 kuidappregistrationresourcefile
Uid3 0xe0000003 // application uid
Resource app_registration_info
{
App_file = "helloworld ";
Localisable_resource_file = // resource // apps // helloworld_loc;
}
Quote:
# Include <appinfo. RH>
# Ifdef required age_01
# Include "helloworld. L01"
# Elif defined then age_02
# Include "helloworld. L02"
# Endif
Resource localisable_app_info
{
Short_caption = string_r_example_short_caption;
Caption_and_icon =
{
Caption_and_icon_info
{
Caption = string_r_example_caption;
Number_of_icons = 1;
Icon_file = // resource // apps // helloworld. MBM;
}
};
}
Quote:
Start resource helloworld_loc.rss
Targetpath/resource/apps
Lang 01 02
End
Quote:
& 01,02
# {"Helloworld_v9_uiq_en", "helloworld_v9_uiq_fr"}, (0xe0000003), 1, 0, 1, type = SA, NC
: "Symbian software Ltd"
% {"Symbian software", "Symbian Logiciel ."}
I have not written the details of the PKG file. Ask modifier @ ioicn,
<End>