# Dictionary Items

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 or macros 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:

<figure><img src="https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-b69dbefae0e5adeb3b8b3bbcbec37fbb29e39cdc%2Fdictionary-item.png?alt=media&#x26;token=a8cde9e2-3366-42ed-830f-233fd8bb0532" alt=""><figcaption></figcaption></figure>

## Adding a Dictionary Item

To add a Dictionary Item:

1. Go to the **Translation** section.
2. Click on **Dictionary** in the **Translation** tree and select **Create**.
3. Enter the **Name** for the dictionary item. Let's say *Welcome*.

   <figure><img src="https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-0ca051a300034cf3c7b6edb434541a9fdfc765d0%2FCreate-dictionary-item.png?alt=media&#x26;token=df5a6643-21a2-42d8-af4a-637ee2c3da94" alt=""><figcaption></figcaption></figure>
4. Click **Create**.
5. Enter the values for the different language versions.

   <figure><img src="https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-bea50d97f4ed64982e0fd7f42eb21683e299820e%2Fdictionary-item-values.png?alt=media&#x26;token=75670aad-f0be-4ed5-a50e-0a0d1b7f7e87" alt=""><figcaption></figcaption></figure>
6. Click **Save**.

### Grouping Dictionary Items

To group dictionary items:

1. Go to the **Translation** section.
2. Click on **Dictionary** in the **Translation** tree and select **Create**.
3. Enter the **Name** for the dictionary item. Let's say *Contact*.
4. Click **Create**.
5. Click on **Contact** and select **Create**.
6. Enter the **Name** of the item to be created under the **Contact** group.
7. Click **Create**.
8. Enter the values for the different language versions.

   <figure><img src="https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-d9e5f2f259f3f385b4ed322839fdf89fefa8c04b%2Fdisplay-dictionary-item.png?alt=media&#x26;token=3b113b74-8475-4a81-b114-745214a1a369" alt=""><figcaption></figcaption></figure>
9. Click **Save**.

## Editing Dictionary Items

To edit a dictionary item, follow these steps:

1. Go to the **Translation** section.
2. 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.
3. Make the edits you need to make.
4. Click **Save** to save the changes.

{% hint style="info" %}
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](https://docs.umbraco.com/umbraco-cms/13.latest/fundamentals/users#creating-a-user-group) article.
{% endhint %}

## 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:

1. Go to the **Settings** section.
2. Open the Document Type where you want to use the Dictionary value.
3. Locate the label and type `#MyDictionaryKey`. For example: `#Welcome` or `#WelcomeDescription`.

<figure><img src="https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-71aafdbe493e81d5214ba532ff3dd7f61cb061c3%2FUsing_Dictionary_Value.jpg?alt=media" alt=""><figcaption><p>Using Dictionary Value in Document Type</p></figcaption></figure>

4. Click **Save**.
5. Go to the **Content** section.
6. View the content node using the Welcome property. The property will display the dictionary value per the user's configured backoffice language.

{% hint style="info" %}
You can translate tabs and property groups in the backoffice as well. For more information, see [How to Translate Umbraco Backoffice Document Types](https://www.youtube.com/embed/OayHhOf47LA?si=iRZ7NE-ckv9LjrSv) video.
{% endhint %}

## Fetching Dictionary Values in the Template

To fetch dictionary values in the template, replace the text with the following snippet:

```csharp
@Umbraco.GetDictionaryValue("Welcome")
```

![Rendering dictionary item](https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-0e03646e5a2b0030dfcdfd4031e1ed66ec60fa48%2Frendering-dictionary-item.png?alt=media\&token=609beecb-29e7-4d00-8fc9-715c53eaf160)

Alternatively, you can specify an `altText` which will be returned if the dictionary value is empty.

```csharp
@Umbraco.GetDictionaryValueOrDefault("Welcome", "Another amazing day in Umbraco")
```

![Rendering dictionary item](https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-e43fc16234cc2a7096fcfcb4c93b3642bc62a9b0%2Frendering-altvalue-dictionary-item.png?alt=media\&token=6d054b6f-2346-4306-bbe8-445538c75516)

## 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

1. Go to the **Translation** section in the Umbraco backoffice.
2. Locate the Dictionary Item (or group) you want to copy in the section tree.
3. Right-click the item.
4. Select **Export...**.
5. Decide whether you want to also include descendants.
6. Click **Export**.

This will download a `.udt` file which you can use to import the Dictionary items on another Umbraco website.

![Right-click the Dictionary Item to open the options menu with the Export feature](https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-c9c209d1ce5214bebb64a84d8ed4b690d2d41ea5%2Fexport.png?alt=media\&token=928d2e77-deb8-4ec3-931d-6addb76c47a4)

### Importing Dictionary Items

1. Go to the \*\*Translation section in the Umbraco backoffice.
2. Right-click on the top of the **Dictionary** tree.
3. Select **Import...**.
4. Click on **Import**.
5. Find and select the `.udt` file containing the Dictionary Items.
6. Click **Open** in the file browser.
7. Review the Dictionary Items for import.
8. Choose where to import the items.
9. Click on **Import**.

The Dictionary Items have now been added to your website.

![Review the Dictionary Items for import before confirming](https://3872888104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgEH4FChbCn7eDDqREvdE%2Fuploads%2Fgit-blob-97c5508a8f8c556058fb63427f9498dc3a41700a%2Fimport.png?alt=media\&token=0ad72f92-1852-4918-9c57-252345310829)

## Using Dictionary Item in a Multilingual website

To use Dictionary Items in a multilingual website, see the [Creating a Multilingual Site](https://docs.umbraco.com/umbraco-cms/13.latest/tutorials/multilanguage-setup) article.

## Related Links

* [API reference for the DictionaryItem](https://docs.umbraco.com/umbraco-cms/13.latest/reference/management/models/dictionaryitem)
* [Localization Service](https://docs.umbraco.com/umbraco-cms/13.latest/reference/management/services/localizationservice)
* [Creating a Multilingual Site](https://docs.umbraco.com/umbraco-cms/13.latest/tutorials/multilanguage-setup)
