Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
---
description: Here you will learn how to apply localization for Document Types in Umbraco.
description: Setup localization for Document Types in the Umbraco backoffice.
---

# Document Type Localization

{% hint style="warning" %}
This article is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
{% endhint %}

The Umbraco backoffice is localized to match the [user's configured language](../users/README.md).
The Umbraco backoffice is localized to match the [user's configured UI Culture](../../../tutorials/multilanguage-setup.md#changing-the-default-backoffice-language-of-a-user).

When defining a Document Type, you can apply localization to:

* Document Type name and description.
* Document Type names and descriptions.
* Property names and descriptions.
* Custom property validation messages.
* Tab and group names.

Setting up localization for Document Types is a two-step process:

* Create the localizations in [user defined backoffice localization file](../../../customizing/foundation/localization.md).
Setting up localization for Document Types is a three-step process:
* Register the Document Type localization files via [a new manifest 'umbraco-package.json' file](../../../customizing/extending-overview/extension-types/localization.md#registering-localization).
* Create the localizations in [user defined Document Type localization files](../../../customizing/extending-overview/extension-types/localization.md#the-localization-file).
* Apply the localizations to the Document Type.

{% hint style="info" %}
Everything in this article also applies to defining [Media Types](../creating-media/) and Member Types.
Everything in this article also applies to defining [Media Types](../../backoffice#media-types) and [Member Types](../../backoffice#member-types).
{% endhint %}

## Registering Document Type localization Files

To register Document Type localizations, you must create a new manifest using an `umbraco-package.json` file.

{% hint style="info" %}
The `umbraco-package.json` file is only registered when placed directly in the `/App_Plugins/` or `/App_Plugins/{SubFolderName}` folder. It will not be recognized in nested subfolders.
{% endhint %}

{% code title="umbraco-package.json" %}
```json
{
"name": "Document Type Localization",
"extensions": [
{
"type": "localization",
"alias": "DocumentType.Localize.En",
"name": "English",
"meta": {
"culture": "en"
},
"js": "/App_Plugins/DocumentTypeLocalization/doctype-en.js"
}
]
}
```
{% endcode %}

## Creating localizations

Once you have [registered a backoffice localization file](../../../customizing/extending-overview/extension-types/localization.md), you can add your localization texts for use in Document Types. The following localizations are used for the samples in this article:
Once you have registered the Document Type localization, you can add your localization texts for use in Document Types. The following localizations are used for the samples in this article:

{% code title="doctype-en.js" lineNumbers="true" %}
```js
Expand Down Expand Up @@ -65,16 +88,16 @@ Umbraco must be restarted to register the localization manifest. Any subsequent

The localizations are applied by using the syntax `#{area alias}_{key alias}`.

1. Create a **Document Type with template** called `#contentTypes_article` with **alias**: `articlePage`.
1. Create a **Document Type with Template** called `#contentTypes_article` with the **alias**: `articlePage`.
2. Under the newly created Document Type follow these steps:

* Name the **description** to `#contentTypes_article-desc`.
* Set the **description** to `#contentTypes_article-desc`.
* Create a new **tab** called `#tabs_content`.
* Add a new **group** called `#groups_titles`.
* Add a **property** called `#properties_title` with **alias** `title`.
* Set description to `{#properties_title-desc}`.
* Set the description to `{#properties_title-desc}`.
* Use a `TextString` editor.
* Enable to `Set this field as mandatory`.
* Set the field validation to `mandatory`.
* Under validation add `#properties_title-message`.

{% hint style="info" %}
Expand All @@ -84,7 +107,7 @@ Property descriptions support [Umbraco Flavored Markdown](../../../reference/umb
![Applying localization to a property](../images/localization-document-type-editor-validation-v15.png)

* Add a **property** called `#properties_subTitle` with **alias** `subTitle`.
* Set description to `{#properties_subTitle-desc}`.
* Set the description to `{#properties_subTitle-desc}`.
* Use a `TextString` editor.
* Enable `Allow at root` in the **Structure** tab.

Expand All @@ -94,10 +117,10 @@ Property descriptions support [Umbraco Flavored Markdown](../../../reference/umb

![Localized document creation dialog](../images/localization-document-editor-create.png)

4. Create a new "Article" content:
4. Create a new "Article" node:

![Localized document editing](../images/localization-document-editor-v15.png)

4. When trying to save the content without adding the mandatory content, you will see a warning as expected:
5. When trying to save the node without adding the mandatory content, you will see a warning as expected:

![Localized property validation](../images/localization-document-editor-validation.png)
Loading