当前位置:网站首页>第十五章 字符串本地化和消息字典(一)
第十五章 字符串本地化和消息字典(一)
2022-07-02 15:18:00 【yaoxin521123】
第十五章 字符串本地化和消息字典(一)
本文概述了字符串本地化,并描述了如何导出、导入和管理消息字典。
字符串本地化
当本地化应用程序的文本时,会创建一种语言的文本字符串清单,然后当应用程序区域设置不同时,建立约定以另一种语言替换这些消息的翻译版本。
支持以下本地化字符串的过程:
- 开发人员在他们的代码中包含可本地化的字符串(在
REST
应用程序或商业智能模型中)。
这种机制各不相同,但最常见的机制是 $$$Text
宏。代替硬编码的文字字符串,开发人员包含 $$$Text
宏的实例,为宏参数提供如下值:
- 默认字符串
- 此字符串所属的域(将字符串分组为域时,本地化更易于管理)
- 默认字符串的语言代码
write "Hello world"
替换为
write $$$TEXT("Hello world","sampledomain","en-us")
- 编译代码时,编译器会在消息字典中为
$$$Text
宏的每个唯一实例生成条目。
消息字典是全局的,因此可以在管理门户中轻松查看(例如)。有一些类方法可以帮助完成常见任务。
- 开发完成后,发布工程师导出该域或所有域的消息字典。
结果是一个或多个 XML
消息文件,其中包含原始语言的文本字符串。
发布工程师将这些文件发送给翻译人员,请求翻译版本。
翻译人员使用他们喜欢的任何
XML
创作工具来处理XML
消息文件。从本质上讲,它们将文本从原始语言翻译成新语言,而不改变周围的XML
。转换器返回一个新的
XML
消息文件,该文件具有相同的结构并且:
- 标识
<MsgFile>
元素的语言属性的新RFC1766
值。 - 包含已识别语言的翻译文本。
- 发布工程师将翻译后的
XML
消息文件导入到导出原始文件的同一个名称空间中。
译文和原文在消息词典中并存。
- 在运行时,应用程序根据浏览器默认语言选择要显示的文本。
消息字典
消息字典是一个 global
,包含按域名、语言名称和消息 ID
组织的文本字符串:
- 每条消息的文本是最多
32K
个字符的字符串。如果数据库启用了长字符串,则字符串可能会更长,但默认最大值为32K
。消息可能只包含文本,也可能包含一个或多个由%1
、%2
等指定的参数。当应用程序页面需要时,可以将这些参数替换为文本(例如错误消息中的文件名)显示消息。 - 域名是任意字符串。它标识一组相关的文本项,例如特定应用程序或页面的所有消息。如果将域分配给一组邮件,可以稍后对具有相同域的所有邮件执行特定操作。
域名区分大小写,可以包含大小写字符。如果域名以 %
开头, 认为该域中的所有消息都是在所有命名空间中可见的系统消息。否则,当创建消息时,它仅在定义它的命名空间中可见。
- 语言名称是符合
RFC1766
的全小写语言标记。它由一个或多个部分组成:主要语言标签(例如 en或
ja)可选地后跟连字符 (-) 和次要语言标签(
en-gb或
ja-jp`)。 - 消息
ID
是任意字符串;它唯一地标识一条消息。消息ID
只需要在域内是唯一的。可以分配一个消息ID
或允许编译器分配一个,这取决于用于创建消息的约定。消息ID
区分大小写,可以包含大小写字符。
消息字典存储
每个用户定义的命名空间都将其消息字典存储在名为 ^IRIS.Msg
的下标全局中。 ^IRIS.Msg
中的下标顺序是域、语言和消息 ID
。
要查看命名空间的 ^IRIS.Msg
- 启动管理门户。
- 切换到感兴趣的命名空间。
- 单击System Explorer > Globals。
- 在
IRIS.Msg
行中,单击查看。
例如
DHC-APP>zw ^IRIS.Msg
^IRIS.Msg("Ensemble")="zh-cn"
^IRIS.Msg("Ensemble","zh-cn",27956811)="Business Rules"
^IRIS.Msg("Ensemble","zh-cn",46484733)="Create New Message Routing Rule"
^IRIS.Msg("Ensemble","zh-cn",52267811)="Business Rule Log"
^IRIS.Msg("Ensemble","zh-cn",56439219)="Edit the configuration of this production."
^IRIS.Msg("Ensemble","zh-cn",59992850)="Edit, Start or Stop an Ensemble Production."
^IRIS.Msg("Ensemble","zh-cn",60154202)="The following PubSub Domain Names are currently defined. PubSub domain names are used to group PubSub subscribers and their associated subscriptions."
^IRIS.Msg("Ensemble","zh-cn",65030300)="Edit Role definition:"
^IRIS.Msg("Ensemble","zh-cn",74372598)="Create New Subscriber"
^IRIS.Msg("Ensemble","zh-cn",103132939)="Defined Data Transformations:"
^IRIS.Msg("Ensemble","zh-cn",140775628)="Suspended"
...
DHC-APP>zw ^CacheMsg
^CacheMsg("Ensemble")="zh-cn"
^CacheMsg("Ensemble","zh-cn",27956811)="Business Rules"
^CacheMsg("Ensemble","zh-cn",39977858)="Select a Business Process"
^CacheMsg("Ensemble","zh-cn",46484733)="Create New Message Routing Rule"
^CacheMsg("Ensemble","zh-cn",52267811)="Business Rule Log"
^CacheMsg("Ensemble","zh-cn",56439219)="Edit the configuration of this production."
^CacheMsg("Ensemble","zh-cn",59992850)="Edit, Start or Stop an Ensemble Production."
边栏推荐
- Flutter: 动作反馈
- Example nonlinear integer programming
- si446使用记录(一):基本资料获取
- 牛客 JS3 分隔符
- Sword finger offer 22 The penultimate node in the linked list
- Migrate your accelerator based SAP commerce cloud storefront to Spartacus
- executescalar mysql_ExecuteScalar()
- 体验居家办公完成项目有感 | 社区征文
- The beginning of life
- Simple linear programming problem
猜你喜欢
[shutter] dart data type (dynamic data type)
Connect Porsche and 3PL EDI cases
Sword finger offer 26 Substructure of tree
Sword finger offer 27 Image of binary tree
线性规划例题 投资的收益与风险
Si446 usage record (II): generate header files using wds3
Eye of depth (III) -- determinant of matrix
【GAMES101】作业4 Bézier 曲线
What if the default browser cannot be set?
Sword finger offer 22 The penultimate node in the linked list
随机推荐
[shutter] dart data type (dynamic data type)
From collection to output: inventory those powerful knowledge management tools - inventory of excellent note taking software (4)
What are the green field and brown field models in software development - green field development and brown field development
easyswoole3.2重启不成功
The beginning of life
Schoolbag novel multithreaded crawler [easy to understand]
2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
When the industrial Internet began to enter the deep-water area, it appeared more in the form of industry
Microservice architecture practice: Construction of highly available distributed file system fastdfs architecture
HBuilderX运行到手机或模拟器提示没有找到设备
[非线性控制理论]7_High gain and High Frequency
2022 interview questions
SSB threshold_ SSB modulation "suggestions collection"
executescalar mysql_ ExecuteScalar()
选择 SAP Spartacus 作为 SAP Commerce Cloud Storefront 实现框架的五个理由
Income and risk of linear programming example investment
visibilitychange – 指定标签页可见时,刷新页面数据
QWebEngineView崩溃及替代方案
871. Minimum refueling times
LeetCode:1380. Lucky number in matrix -- simple