Language Variants
Language Variants is a new feature included in Umbraco 8. It allows you to vary content by culture, so you can allow a content node to exist in several languages.
Video tutorial
How to enable Language Variants
The first thing to ensure when you want to work with Language Variants is that you have more than one language enabled, this can be done from the Settings
section:
Note that you will always have one default language but each language can be set to mandatory if you want.
Enabling Language Variants on doctypes
Now that there are two languages to vary the content with, it needs to be enabled on the document types you wish to use it with. To do so head to a document type in the Settings section. In the top right corner you can go to permissions and then check the "Allow varying by culture" toggle:
Now to allow a property on the doctype to be varied it will have to be enabled for the property:
Working with Language Variants on content
When you return to your content node you will notice two things.
- At the top of the content tree there will now be a dropdown so you can show the content tree in the language of your choice.
- To the right of the content name there is now a dropdown where you can select a language. You can also open a split view so you can see two languages at once.
Each property editor that does not allow variants will be greyed out and have the content of the default language.
To read about how you render variant content in templates, check out the rendering content section.
Test your language variants
Culture and hostnames must be added to your language sites before the content can be tested for variants.
- Right-click the Home node and select Culture and Hostnames.
- Add a specific url per language and save. For eg: An English language variant with English (United States) as the language can be given a specific url https://yourwebsite.com/en-us and a Danish language variant can be given a specific url https://yourwebsite.com/dk.
- The Info content app should now show specific urls for your language variants.