从版本< 3.1 >
由superadmin编辑
在2024/12/12, 21:32上
到版本
由superadmin编辑
在2024/12/12, 21:35上
< >
修改评论 该版本没有评论

Summary

Details

Icon Page properties
Content
... ... @@ -27,4 +27,156 @@
27 27  出于兼容性原因,作为扩展分发的模块保留了它们的字典文件在根文件夹中的方式,但iTop核心模块(datamodels/2.x)已经进行了修改。
28 28  
29 29  
30 +== 字典文件格式 ==
31 +
32 +字典实际上是一个PHP文件。它必须以UTF-8字符集编码(这是必须的)。我们建议像下面的示例一样省略PHP的结束标记:
33 +
34 +(% class="box" %)
35 +(((
36 +<?php
37 +/\*\*
38 +\* Localized data
39 +\*
40 +\* @copyright   Copyright (C) 2015 John Foo Ltd
41 +\* @author      John Foo (john@foo.com)
42 +\* @license     http:~/~/opensource.org/licenses/AGPL-3.0
43 +\*/
44 +Dict::Add('PT BR', 'Brazilian', 'Portuguese', array(
45 + 'Menu:ChangeManagement' => 'Gerenciamento Mudanças',
46 + 'Menu:Change:Overview' => 'Visão geral',
47 + 'Menu:NewChange' => 'New Change~~~~',
48 +));
49 +)))
50 +
51 +
52 +注意事项:
53 +
54 +* 函数调用的第一个参数是大写的语言代码。
55 +* 函数调用的第二个参数是英语中的语言名称。
56 +* 函数调用的第三个参数是目标语言中的语言名称。
57 +* Dict::Add 函数的行在所有相同语言的字典文件中必须相同(是的,这里有冗余信息)。
58 +* 请注意某些字符串末尾的 ~~~~。这个后缀不会显示给最终用户。它由Combodo在发布新版本时添加,用于显示哪些新字符串需要翻译。
59 +
60 +== 一些通用规则 ==
61 +
62 +一些通用规则:
63 +
64 +* **保持一致性:** 重复使用已经翻译的术语(例如,“经理”是许多关键词中使用的词汇)。
65 +* **英文术语:** 如果在上下文中更容易理解,可以保留英文术语。
66 +* **避免过于口语化的表述:** iTop是一款既被公司使用又被其客户使用的产品。
67 +* **不要硬编码“iTop”名称:** 使用常量(它们在 core/config.class.inc.php 中定义):
68 +** ITOP_APPLICATION:应用程序包的完整名称,例如“iTop Community”或“iTop Professional”。
69 +** ITOP_APPLICATION_SHORT:应用程序的名称,例如“iTop”。
70 +* **类名命名方式:** 使用驼峰命名法。
71 +* **数据模型项目命名标准:** Class:<classname>、Class:<classname>/Attribute:<fieldname>。例如:Class:Ticket、Class:Ticket/Attribute:ref、Class:UserRequest/Attribute:status/Value:new。
72 +* **字段标签翻译:** 请在定义字段的类中进行翻译,而不是在子类中进行。例如,对于 Class:Ticket/Attribute:ref 是可以的,但对于 Class:Change/Attribute:ref 则不应该。如果需要后者,可以使用自定义模块将其添加到您的iTop实例中。
73 +* **操作标签中的类别:** 尽量不要在通用用户的操作标签中提及类别。但对于管理员用户可以这样做。如果使用类别标签,请将其大写化,例如将“notification”改为“Notification”。
74 +* **特殊条目 Class:<classname>/Attribute:friendlyname:** 在英文中显示为“Full name”,如果没有翻译,它不对应于特定的类字段,而是对应于用作外部键、对象列表和对象详情中的对象标签的魔法属性。
75 +
76 +这些规则有助于维护和确保翻译的一致性。
77 +
78 +
79 +|=Key syntax|=Purpose|=Example
80 +|Class:<classname>|Translating the **name** of a class|Class:Ticket
81 +|Class:<classname>/Attribute:<fieldname>|Translating a field **label**|Class:Ticket/Attribute:ref
82 +|Class:<classname>/Attribute:<fieldname>/Value:<value>|Translating a **value** of an Enum attribute|Class:UserRequest/Attribute:status/Value:new
83 +|Class:<classname>/Attribute|Formatting the friendlyname **value**. (//see example below//)|‘Class:Person/Name’ ⇒ ‘%2$s %1$s’
84 +
85 +//Friendlyname 语法//: 在这个示例中
86 +
87 +{{{'Class:Person/Name' \=> '%2$s, %1$s', /\* example: "Christie, Agatha" \*/
88 +}}}
89 +
90 +* %1$s 对应于Person类的命名XML标签中的第一个字段,因此是 first_name。
91 +* %2$s 对应于Person类的命名XML标签中的第二个字段,因此是 name。
92 +
93 +这允许指定不同的顺序,并且甚至是一些其他字符和分隔符。
94 +
95 +您可以通过以下链接获取有关 friendlyname 的更多信息:[[friendlyname>>url:https://www.itophub.io/wiki/page?do=export_code&id=3_1_0:customization:translation&codeblock=2]]。
96 +
97 +
98 +(% class="box" %)
99 +(((
100 +<classes\>
101 + <class id\="Person"\>
102 + <properties\>
103 + <naming\>
104 + <attributes\>
105 + <attribute id\="first\_name"/> <!~-~- mapped to %1$s ~-~->
106 + <attribute id\="name"/>       <!~-~- mapped to %2$s ~-~->
107 + </attributes\>
108 + </naming\>
109 +)))
110 +
111 +== 字典关键词的命名约定 ==
112 +
113 +新条目的命名应根据其领域和目的,从最不具体的信息开始命名。
114 +
115 +最常用的分隔符是’:’,但也可以找到’/‘和’-’。
116 +
117 +(% class="box" %)
118 +(((
119 +'Core:BulkExport:TextFormat' \=> 'Text fields containing some HTML markup',
120 +'UI:CSVImport:TextQualifierCharacter' \=> 'Text qualifier character',
121 +'DayOfWeek-Sunday-Min' \=> 'Su',
122 +)))
123 +
124 +
125 +使用后缀来定义相同标签的变种:
126 +
127 +* + 表示短描述(通常显示在工具提示中)
128 +* ? 表示帮助/解释(可以跨多行)
129 +
130 +(% class="box" %)
131 +(((
132 +'Core:SynchroAtt:update' \=> 'Update ?',
133 +'Core:SynchroAtt:update+' \=> 'Used to update the object',
134 +'UI:CSVImport:AdvancedMode' \=> 'Advanced mode',
135 +'UI:CSVImport:AdvancedMode+' \=>
136 + 'In advanced mode the "id" (primary key) of the objects can be used to update and rename objects.'
137 + .'However the column "id" (if present) can only be used as a search criteria'
138 + .' and can not be combined with any other search criteria.',
139 +)))
140 +
141 +当建立了命名约定后,标识符应该指定为 :,就像以下示例中的方式:
142 +
143 +(% class="box" %)
144 +(((
145 +'Class:Event/Attribute:date' \=> 'Date',
146 +'Class:Event/Attribute:date+' \=> 'date and time at which the changes have been recorded',
147 +)))
148 +
149 +请注意,在这种情况下,分隔符应该是 ‘/’。
150 +
151 +(% class="wikigeneratedid" %)
152 +==== ====
153 +
154 +==== 枚举值 ====
155 +
156 +枚举或枚举集的值使用自己的语法:
157 +
158 +{{{ 'Class:Action/Attribute:status/Value:test' \=> 'Being tested',
159 + 'Class:Action/Attribute:status/Value:test+' \=> 'Action has maybe a different behavior than when in production',
160 + 'Class:Action/Attribute:status/Value:enabled' \=> 'In production',
161 + 'Class:Action/Attribute:status/Value:enabled+' \=> '',
162 + 'Class:Action/Attribute:status/Value:disabled' \=> 'Inactive',
163 + 'Class:Action/Attribute:status/Value:disabled+' \=> 'Action is not effective',
164 +}}}
165 +
166 +==== 实体覆盖 ====
167 +
168 +子类可以覆盖属性(或值)的标签/工具提示,即使该属性已在其父类之一中定义。
169 +
170 +{{{ 'Class:ActionEmail/Attribute:status/Value:test+' \=> 'Only the Test recipient is notified',
171 + 'Class:ActionEmail/Attribute:status/Value:enabled+' \=> 'All To, Cc and Bcc emails are notified',
172 + 'Class:ActionEmail/Attribute:status/Value:disabled+' \=> 'The email notification will not be sent',
173 + 'Class:ActionEmail/Attribute:test\_recipient' \=> 'Test recipient',
174 +}}}
175 +
176 +=== 关系 ===
177 +
178 +默认链接相关的操作/图标工具提示、弹出窗口标题和确认消息如下所示。
179 +
180 +它们可以根据需要进行自定义,甚至可以根据类别/关联设置属性进行定制化(请参阅下文)。
181 +
30 30  
深圳市艾拓先锋企业管理咨询有限公司