Define your own dictionary entries
Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.
- Change a label for a field, a button, a menu,...
- Dictionary, XML
- min version:
With this tutorial you will learn how to modify a label displayed somewhere in iTop and create new dictionary entries.
with the Designer
All the dictionary entries can be edited globally using the tab “Dictionary” under the main tab “Editors”:
Use the form to search for the dictionary entries to be edited.
You can search on the code of the entry (for
Class:Person) or its content,
or both. If both criteria (code and content) are supplied, only
entries matching both criterias are displayed.
For each entry matching the search criteria, several text input areas are displayed, one for each language enabled for your licence. Should you need more languages, please contact Combodo support to have them enabled for your licence.
To apply your modifications to the dictionary, either press the validation mark next to each modified entry, or use the “Apply All” button at the top.
If the dictionary entry you are looking for, does not exist (for example a new entry from the XML portal) then you can create it with the “New” button.
with an iTop Extension
Modify an XML entry
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:
uifor labels used in the User Interface (UI)
corefor 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.
_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>
caller_idis a field of the Ticket class, but the above entry was made on UserRequest class, as a result on other Ticket sub-classes such as Incident or Change, this field will still be labelled
New XML entry
_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.
More on iTop translation
Using dictionary files
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