Dictionary Items
Creating Dictionary Items in Umbraco
Depending on how your site is set up, not all content is edited through the Content section. There might be some text in your templates that needs translation. Using Dictionary Items, you can store a value for each language. Dictionary Items have a unique key that is used to fetch the value of the Dictionary Item.
Dictionary Items can be managed from the Translation section. Let's take a look at an example. In this example, we will translate "Welcome to Umbraco" from within the template and add it to the dictionary:
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-b69dbefae0e5adeb3b8b3bbcbec37fbb29e39cdc%252Fdictionary-item.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=f123c024&sv=1)
Adding a Dictionary Item
To add a Dictionary Item:
Go to the Translation section.
Click on Dictionary in the Translation tree and select Create.
Enter the Name for the dictionary item. Let's say Welcome.
Enter the values for the different language versions.
Click Save.
Grouping Dictionary Items
To group dictionary items:
Go to the Translation section.
Click on Dictionary in the Translation tree and select Create.
Enter the Name for the dictionary item. Let's say Contact.
Click Create.
Click on Contact and select Create.
Enter the Name of the item to be created under the Contact group.
Click Create.
Enter the values for the different language versions.
Click Save.
Editing Dictionary Items
To edit a dictionary item, follow these steps:
Go to the Translation section.
Use the Dictionary tree to locate the item you need to update/edit.
Alternatively, you can use the search field in the top-right corner.
Make the edits you need to make.
Click Save to save the changes.
It will only be possible to edit the language(s) that the given user has access to. The value of the remaining languages will be read-only.
Which language a user has access to is determined by the "Language permissions" set on the User Group. Learn more about this feature in the Users article.
Using Dictionary Values in Document Types
In some cases, you might want to render the dictionary values in the Document Type. This is to display the labels depending on the language configured for the logged-in user.
To use dictionary values in the Document Type, follow these steps:
Go to the Settings section.
Open the Document Type where you want to use the Dictionary value.
Locate the label and type
#MyDictionaryKey
. For example:#Welcome
or#WelcomeDescription
.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-71aafdbe493e81d5214ba532ff3dd7f61cb061c3%252FUsing_Dictionary_Value.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c90407b7&sv=1)
Click Save.
Go to the Content section.
View the content node using the Welcome property. The property will display the dictionary value per the user's configured backoffice language.
You can translate tabs and property groups in the backoffice as well. For more information, see How to Translate Umbraco Backoffice Document Types video.
Fetching Dictionary Values in the Template
To fetch dictionary values in the template, replace the text with the following snippet:
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-0e03646e5a2b0030dfcdfd4031e1ed66ec60fa48%252Frendering-dictionary-item.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=7bd4bbe7&sv=1)
Alternatively, you can specify an altText
which will be returned if the dictionary value is empty.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-e43fc16234cc2a7096fcfcb4c93b3642bc62a9b0%252Frendering-altvalue-dictionary-item.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=826b23ca&sv=1)
Importing and exporting Dictionary Items
In some cases, you might want to use the same Dictionary Items on multiple Umbraco websites. For this, you can use the export and import functionality to quickly copy the items from one website to another.
Exporting Dictionary Items
Go to the Translation section in the Umbraco backoffice.
Locate the Dictionary Item (or group) you want to copy in the section tree.
Click ... next to the Dictionary item (or group).
Select Export....
Decide whether you want to also include descendants.
Click Export.
This will download a .udt
file which you can use to import the Dictionary items on another Umbraco website.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-c9c209d1ce5214bebb64a84d8ed4b690d2d41ea5%252Fexport.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c5394708&sv=1)
Importing Dictionary Items
Go to the Translation section in the Umbraco backoffice.
Click ... next to the Dictionary tree.
Select Import....
Click on Import.
Find and select the
.udt
file containing the Dictionary Items.Click Open in the file browser.
Review the Dictionary Items for import.
Choose where to import the items.
Click on Import.
The Dictionary Items have now been added to your website.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-97c5508a8f8c556058fb63427f9498dc3a41700a%252Fimport.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=e2b3ada&sv=1)
Using Dictionary Item in a Multilingual website
To use Dictionary Items in a multilingual website, see the Creating a Multilingual Site article.
Related Links
Last updated