本地化(Language localisation)
来源:互联网 发布:谈谈怎样看待网络暴力 编辑:程序博客网 时间:2024/06/03 22:32
作者:cofd 文章来源:本站原创 更新时间:2005-8-30 3:06:11 3996
本地化(Language localisation)
1、简介
为Symbian应用程序添加本地化资源(localisation aware resources)。
2、设计和实现
与本地化有关的实体:
项目定义文件
定义支持的语言
独立的资源文件
与特定语言相关的资源文件
2.1 项目定义文件
使用本地化资源的应用程序必须在项目定义文件中定义支持的语言。这些语言的相关的资源文件将在编译过程中创建。
通过在.mmp文件中添加 LANG 语句。如果要支持英语和汉语,则添加:
LANG 01 31。 01 代表英语,31代表简体中文
2.2 定义支持的文件
Symbian OS为特定设备支持的语言定义了一个标识符。例如在支持中文的设备上这个标识符就是 LANGUAGE_31.
可以通过Language.loc决定装载哪种语言的资源文件。Language.loc的内容如下:
#ifdef LANGUAGE_01
#include "Language.l01"
#endif
#ifdef LANGUAGE_31
#include "Language.l31"
#endif
其中Language.l01和Language.l31分别是英语和汉语的资源文件
2.3 独立的资源文件
在rss文件中定义符号标识资源。例如:
MENU_ITEM {command = EAknSoftkeyExit; txt = LANG_MENU_EXIT;}而不是一般的
MENU_ITEM {command = EAknSoftkeyExit; txt = "Exit";}
2.4 特定语言的资源文件
应用程序需要为它支持的每一种语言提供特定的资源文件。每一个这种资源文件中定义了rss文件中标识资源的符号在特定语言中的内容。例如在Language.l31中定义的中文资源文件内容如下:
CHARACTER_SET UTF8
// APPLICATION INFORMATION
#define ELanguage ELangPrcChinese // Caption language
// LOCALISATION STRINGS
/*
-----------------------------------------------------------------------------
Menu texts
-----------------------------------------------------------------------------
*/
#define LANG_MENU_COMMAND1 "显示"
#define LANG_MENU_EXIT "退出"
/*
-----------------------------------------------------------------------------
MessageBox text
-----------------------------------------------------------------------------
*/
#define LANG_I_COMMAND1 "中文"
注意要将此文件第一行为CHARACTER_SET UTF8,要将该文件保存为UTF-8格式,如果编译是出现错误"undefined character..."是只要将该文件第一行修改为CHARACTER_SET UTF8就可以了。这是因为ANSI文件转为UTF-8文件,文件头会多出了3个字节
Note: If you’re using MS Visual Studio, you’ll find out that introduces a problem here, since it only supports ANSI. You can easily edit the file in Notepad, which, (in Win2K & XP) lets you save the file as UTF-8. Unfortunately, notepad has the side effect of prefixing the file with the three bytes 0xEF, 0xBB, 0xBF, which make the file unreadable by the compiler. You can fix this by opening the file in Visual studio and deleting these characters.
2.5 使用资源
CONE's AllocReadResourceLC(...) 或者StringLoader::LoadLC(...)
3.Summary
概括了本地化资源相关的实体。
演示了如何为Symbian应用程序添加本地化资源(localisation aware resources)。
提供了两个提取资源的API
modify:
4。安装
在.pkg文件中添加语言指示。例如为本例添加:
&EN, ZH
接着在.pkg文件中找到下面的代码
"/Symbian/UIQ_70/Epoc32/data/z/system/apps/MyApp/MyApp.rsc"- "!:/system/apps/MyApp/MyApp.rsc"
修改为:
{"/Symbian/UIQ_70/Epoc32/data/z/system/apps/MyApp/MyApp.rsc",
"/Symbian/UIQ_70/Epoc32/data/z/system/apps/MyApp/MyApp.r31"}
-"!:/system/apps/MyApp/MyApp.rsc"
如果一切顺利,安装时你可以选择安装某种语言,且只有这种语言的资源才被安装。
Enjoy!
- 本地化(Language localisation)
- 本地化(Language localisation)
- 本地化
- 本地化
- 本地化
- 本地化
- 本地化
- 本地化
- 本地化
- Windows 8引入的新的language tag导致的本地化问题
- language
- language
- 论文阅读:Synthetic Data for Text Localisation in Natural Images
- 论文阅读:Synthetic Data for Text Localisation in Natural Images
- 论文笔记-Synthetic Data for Text Localisation in Natural Images
- 本地化XtraGrid。
- 本地化处理
- 本地化XTRAGRID
- android 开发 @override 编译错误 解决办法
- spring mvc int 类型转换错误
- 泡泡堂、QQ堂游戏通信架构分析
- Maya2012
- TableLayout中的widgets
- 本地化(Language localisation)
- Java1.5泛型指南中文版(Java1.5 Generic Tutorial)
- 信息系统项目管理系列之九:项目质量管理
- 2011-4-9个人规划审视
- oracle数据库学习从零开始
- magento -- magento中如何判断一个用户是否已经登陆
- magento -- 推荐插件 -- Mass Product Relater
- 系统构架设计应考虑的因素
- 指向成员的指针