intra-mart Accel Platform 脚本开发模式编程指南 第16版2020-04-01

多语言

总览

什么是多语言支持?

多语言意味着系统可以使用多种语言,而不仅仅是一种语言。

intra-mart Accel Platform多语言支持

intra-mart Accel Platform intra-mart以下四种支持多语言的组件。
  • 语言定义
定义intra-mart Accel Platform使用的语言。
  • 讯息定义
为了将消息显示给用户,已经为intra-mart Accel Platform定义的所有语言准备了翻译。
消息由“语言ID”和“消息代码”管理。
  • 语言解析
用户可以注册用于intra-mart Accel Platform的语言。
如果您不注册,将使用自动解析的语言。
有关语言解析的顺序,请参阅预定义的访问上下文
  • 取得讯息
intra-mart Accel Platform提供用于获取多语种消息的API(MessageManager)。
MessageManager从“消息代码”和“用户语言”中获取相应的消息。
有关使用MessageManager的信息,请参阅检索多语言消息

语言定义

初始语言定义

intra-mart Accel Platform在初始状态下定义intra-mart语言如下。
语言能力 语言ID
英文 en
日本语 JA
中文(简体) zh_CN
  • 语言主文件
intra-mart Accel Platform定义intra-mart语言以称为“语言主文件”的XML描述。
默认系统默认语言是英语。
  • 配置文件
%CONTEXT_PATH%/ WEB-INF / conf / locale-config / im-locale-default.xml

讯息定义

intra-mart Accel Platform中的消息intra-mart构成要素为以下三个。
  • 讯息码
这是与消息内容关联的代码。
intra-mart Accel Platform提供的消息代码基于内部规则,因此无需了解代码系统。
  • 语言ID
intra-mart Accel Platform定义的语言在语言主文件中定义为语言ID。
  • 翻译的讯息
仅针对intra-mart Accel Platform定义的语言提供翻译。

消息属性文件

该文件包含该消息。
  • 文件命名约定

    {任意名称} _ {语言ID} .properties
    • 一个例子
    语言能力 档案名称
    英文 example_en.properties
    日本语 example_ja.properties
    中文(简体) example_zh_CN.properties

    注意

    请不要在{任意名称}部分下划线 (_)。

    (示例)test_message_ja.properties
  • 文件内容

    {消息代码} = {翻译后的消息}
    • 一个例子

      example_en.properties

      I18N.MESSAGE.EXAMPLE=这是消息的示例。
      

      example_ja.properties

      I18N.MESSAGE.EXAMPLE=\ u3053 \ u308c \ u306f \ u30e1 \ u30c3 \ u30bb \ u30fc \ u30b8 \ u306e \ u4f8b \ u3067 \ u3059 \ u3002