定义自己的字典条目

决条件:您必须熟悉教程中使用的语法 并且已经创建了一个扩展.

学习:用于字段的修改标签,按钮,菜单,...

水平:初学者

域:字典, XML文件 

最低版本:2.1.0

修改现有标签

在XML中

您要变更一个iTop标签。

首先要做的是找到其代码。

对于通用标签,请检查您的文件your-itop/dictionary/en.dictionary.itop.xxx.php, 其中xxx是:

  • User Interface (UI)中使用的标签的ui
  • 字段类型和通用对象的标签的核心,例如:历史记录,触发器-功能,DataSynchro,BulkExport等

对于与Datamodel类相关的标签,其代码将位于your-itop/datamodels/2.x/xxx/en.dict.xxx.php中,其中xxx是处理该类的模块名称。

获得代码后,只需按如下所述在扩展名中重新定义其价值。
如果不确定以前是否有该代码的条目,请注意_delta =“ redefine”替换现有的价值和_delta =“ force”。

在此示例中,我们假设在您的iTop中,UserRequest的“请求者”应称为受益人,因此这是执行此操作的方法:

itop_design / dictionaries
 
    <dictionary id="EN US" _delta="must_exist">
      <entries>
        <entry id="Class:UserRequest/Attribute:caller_id" _delta="redefine">
          <![CDATA[Beneficiary]]>
        </entry>
        <entry id="Class:UserRequest/Attribute:caller_id+" _delta="force">
          <![CDATA[Choose the client person who will get the requested service]]>
        </entry>
      </entries>
    </dictionary>

第二个条目,其相同的代码由一个加号完成,并与其他信息相对应,当在读取模式下将鼠标移到该字段上时,将为属性显示为工具提示,作为工具提示

创建一个新条目

在XML中

注意_delta =“ define”来创建一个新条目,如果该条目已经存在,它将失败。

itop_design / dictionaries
 
    <dictionary id="EN US" _delta="must_exist">
      <entries>
        <entry id="Class:Team/Attribute:dashboard" _delta="define">
          <![CDATA[Overview]]>
        </entry>
      </entries>
    </dictionary>

在这里,我们在英语词典中创建了一个条目。
用FR FR代替EN US EN以获得法国标签。

如果要为多种语言定义标签,请复制XML结构。

在这里检查ISO国家/地区值。 iTop支持任何语言,但本机仅包含几种语言。

将词典文件用于新条目

您可以在php文件中定义每种语言的一种,而不是用XML定义字典条目。看到这里 有关此方法的示例

原贴链接:https://www.itophub.io/wiki/page?id=2_7_0%3Acustomization%3Aadd-dictionay-entry


Define your own dictionary entries

Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.

learning:
Change a label for a field, a button, a menu,...
level:
Beginner
domains:
DictionaryXML
min version:
2.1.0

Modifying an existing label

In XML

You want to change an iTop label.

First things to do is to find its code.

For generic labels, check those files your-itop/dictionary/en.dictionary.itop.xxx.php, where xxx is:

  • ui for labels used in the User Interface (UI)

  • core for labels of field types and generic objects such as: History, Trigger-Action, DataSynchro, BulkExport,…

For a label related to a Datamodel class, its code will be in your-itop/datamodels/2.x/xxx/en.dict.xxx.php where xxx is the module name which handle that class.

Once you have the code, you just need to redefine its value in a extension, as described below.
Note the _delta=“redefine” to replace the existing value and the _delta=“force” if you are not sure that there was previously an entry for that code.

In this example we will suppose that in your iTop, the “Requestor” of a UserRequest, should be called Beneficiary, so here is how to do this:

itop_design / dictionaries
 
    <dictionary id="EN US" _delta="must_exist">
      <entries>
        <entry id="Class:UserRequest/Attribute:caller_id" _delta="redefine">
          <![CDATA[Beneficiary]]>
        </entry>
        <entry id="Class:UserRequest/Attribute:caller_id+" _delta="force">
          <![CDATA[Choose the client person who will get the requested service]]>
        </entry>
      </entries>
    </dictionary>

The second entry, with the same code completed by a plus sign correspond to additional information, displayed for Attribute as a tooltip when moving your mouse over the field in read mode

Creating a new entry

In XML

Note the _delta=“define” to create a new entry, it will fail if that entry already exist.

itop_design / dictionaries
 
    <dictionary id="EN US" _delta="must_exist">
      <entries>
        <entry id="Class:Team/Attribute:dashboard" _delta="define">
          <![CDATA[Overview]]>
        </entry>
      </entries>
    </dictionary>

Here we created an entry in the english dictionary.
Replace EN US by FR FR for French labels.

Duplicate the XML structure if you want to defined labels for multiple languages.

Check here for ISO country values. iTop supports any language, but natively includes only a few.

Using dictionary files for new entries

Instead of defining dictionary entries in XML, you may define them in php file, one per language. See here for an example of this method

标签:
由 superadmin 在 2020/08/27, 17:13 创建
    

需要帮助?

如果您需要有关XWiki的帮助,可以联系:

深圳市艾拓先锋企业管理咨询有限公司