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:
- Dictionary, XML
- 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>
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>
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