Locales

This article provides an introduction to Prismic languages and locales.

This document explains how to add locales to your Prismic repository. Want to learn how to copy and translate content? See Navigate Languages and Copy Content.

Prismic supports localization, allowing you to set localized versions of each document.

A locale represents a language and a region. Each locale has a five-character locale code, formatted la-re, where la stands for a language and re stands for a region.

You can use locales for:

  • translating content (en-ca and fr-ca for English and French Canadian content)
  • localizing content (en-gb and en-us for British and American content)
  • both translating and localizing (en-us and es-mx for English US and Spanish Mexican content). If you don't find your desired locale, you can create your own custom locales, as described below.

Add a language

Here, you will learn how to set the master locale and add more locales to your Prismic repository.

Set the main locale

The master locale is the default locale of your repository.

To change the master locale, perform the following steps:

  • In your repository, navigate to Settings > Translations & locales. You will find the list of locales available in your repo.
  • Click on the 'Set as master' button.

The selected locale will now be the default locale of the repo and will be the first in the languages array in the API CDN response at https://your-repo-name.cdn.prismic.io/api/v2, which includes an is_master boolean:

Copy
"languages": [
 {
  "id": "en-us",
  "name": "English - United States",
  "is_master": true
 },
 {
  "id": "ar-bh",
  "name": "Arabic - Bahrain",
  "is_master": false
 },
 {
  "id": "ja-jp",
  "name": "Japanese",
  "is_master": false
 }
],

Add more locales

To add a locale, perform the following steps:

  • In your repository, navigate to Settings > Translations & locales. You will find the master locale along with the option to Select an existing locale from the list or create your own.
  • Click on the dropdown icon. It will show a list of available languages. Select the required locale from the list. The selected locale code will appear.

The new locale will be available in the language dropdown of the document list and inside each document.

Can I delete a locale?
Yes, you can delete a locale in Settings. But first, you will need to delete all documents from that locale. Learn more about how to archive and delete a document.

If you translate a document to the French locale, for example, fr-fr will be available in the "alternate_languages" property of the API response.

Copy
"alternate_languages" : [
  {
     "id": "XTb4mBAAACQAOfrg",
     "type": "homepage",
     "lang": "fr-fr"
  }

Add custom locales

To create a locale that isn't available in the list of options, follow these steps:

  1. Go to your repository and navigate to Settings > Translations & locales; click on Select an existing locale from the list or create your own. Then, Scroll down to the bottom of the existing locales and click on + Create a custom locale. It will open an overlay.
  2. Type a language in the Language and Region. This will automatically generate a two-character locale code.

Related articles


Can't find what you're looking for?

Need technical Support? Spot an error in the documentation? Get in touch with us on our Community Forum.