Contentstack has a sophisticated multilingual capability. It allows you to create and publish entries in any language. This feature allows you to set up multilingual websites and cater to a wide variety of audience by serving content in their local language(s). And, all of this can be done without the need to code.
Contentstack offers multi-language support, which allows you to create entries in any language of your choice. However, when creating entries in other locales, they inherit data initially from the master language until they are localized.
Let's consider an example to understand this better. Let’s say you wish to create a multi-language site that serves content in several languages: English (United States), French (France), Spanish (Spain), and Japanese (Japan).
And, if you have set English (United States) as the master language, you will need to add French, Spanish, and Japanese manually. Learn more about adding a language, here.
Now, when you first create an entry in the master language, i.e., English (United States), the same data is reflected in the entries of the 'French (France)', 'Spanish (Spain)', and 'Japanese (Japan)' languages (in English though). They inherit data from the master language.
So, after creating an entry in English, when you select a language (say, French), you will see the same data that is saved for English (United States). This is called language inheritance. The entry in English (United States) becomes the parent entry, and the other copies becomes the child entries.
So, if you make any changes to the entry in parent language, the same changes will be reflected in the child entry too.
The child entry continues to inherit data from the parent language, until you localize it.
In Contentstack, each supported language is identified by a corresponding country-language code. This code comprises two designators (language and country), separated by a hyphen (-).
'en_us' for English - United States
'fr_fr' for French - France
'es_ar' for Spanish - Argentina
The first designator of the code (en_us) represents the language. We use ISO 639-1 Alpha-2 standard (which is a two-letter code) for this.
The second designator is the country code (en_us), for which, we use the ISO 3166-1 Alpha-2 country code format.
When you localize a child entry, it ceases to fetch data from the master language. It breaks the inheritance from the master entry and becomes independent. Therefore, once you localize the child entry, the changes made in the master language will not be reflected in the child entry.
To localize an entry, open the entry in the master language. Select the child language using the language selector located on the top-right corner of the page. This will open the unlocalized copy of the entry. You then simply need to replace the content (English) in the chosen language, and click on 'Save' or publish the entry. This will localize the selected child entry.
As shown in the following diagram, localizing will cause the inheritance present between the master and child entries to break, and an independent copy of the child entry is created that will possess the same format of the master entry, but with different content.
This localized entry is now a separate entity altogether. It will have its own versioning system and publishing queue status.
Once an entry has been localized, you can unlocalize it again anytime. Learn more about unlocalization, here.
Let’s have a look at the process of adding a language to your stack.
Once the required language has been added to a stack, the Content Manager can add content in the specified language, or create a localized entry.
Note:The Content Manager can view or create content in multiple languages only if the languages are added to the stack by the Admin/Developer.
Go to the page of the entry that you wish to localize. Then, select the language using the language selector option located on the top-right corner of the page. The page that appears is the unlocalized copy of the original entry.
Replace the existing content with the content in the appropriate language. Then, as soon as you click on 'Save,' a new, localized copy of the same entry will be created. This new copy will then cease to fetch data from the main entry in master language. So, any changes made to the entry in the master language will not have any impact on the localized copy.
Localizing an entry does not create a separate item in the main list of entries. Under any given content type, you will only see the list of entries in the master language, that is, English (United States). Edit the required entry, and then select the language of your choice. You will then be able to view/edit the localized entry.
Once an entry has been saved in a different language, it becomes independent of the master language. You can modify this data as per your requirement. Modifying and saving your entry multiple times will increment the version count. Therefore, each language entry has a separate versioning system. This enables you to compare your entry with earlier versions, if needed.
Note: The Content Manager can view or create content in multiple languages only if the languages are added to the stack by the Admin/Developer.
You can view information about the localization status of an entry through the ‘Edit Entry’ page of an entry. To do so, click the ‘Entry Information’ tab on the right-hand side panel of the ‘Edit Entry’ page of your entry. Under the ‘Localization Status’ section, you will find a list of all the languages that are part of your stack.
The languages are separated under three sections: ‘Master’, ‘Localized’, and ‘Unlocalized’. Each language is linked to the latest version of the entry in the specific language.
The ‘Master’ subsection possesses the link to the version of the entry in the master language. The ‘Localized’ subsection displays the languages in which your entry has been localized. And lastly, the ‘Unlocalized’ subsection displays the languages in which your entry has not yet been localized.
Clicking on any of the above links will take you to the ‘Edit Entry’ page of the localized entry where you can view and manage them.
Master language is the primary language of your stack. When you create a new stack in Contentstack, you will be prompted to set a language as the master language for your stack. You can later add as many languages as you want for the purpose of localization.
For example, a Japanese user can set the master language of the Stack to 'Japanese' and can publish all data in Japanese. The user can later add English (United States) or any other language as an additional language, and publish in these languages, too. Read Localization for more details.
Contentstack allows you to unlocalize a localized entry. When a localized entry is unlocalized, it again starts inheriting data from the master locale entry. The local copy of the entry is deleted, and all the localized content is lost.
To unlocalize a localized entry for a particular language, open the entry, and select the language. This will open the localized copy of that language. Then, from the options given at the bottom of the page, select 'Unlocalize' and confirm.
Any language added to your stack can be renamed. To do so, click on a language under the 'Languages' section. In the 'Update Language' window that appears, change the name of the language by editing the 'Display Name' textbox. For example, 'Spanish (Spain)' can be renamed to 'Spanish News Portal'.
In this tutorial, we will see how to provide a custom name to a language.
To delete an existing language from a stack, go to Settings > Languages. When you hover on any of the languages (except the default language), you will notice an icon with three vertical dots, which is the 'More Options' icon, on the right. Click on this icon and select the 'Delete' option.
Note:You cannot delete the default language.
When creating custom roles, apart from assigning rights and permissions, the Owner or the Developer of the stack can assign languages too. This feature enables you to allow/restrict publishing rights to users on specific languages. Read Roles for more details.