Skip to content

Best Practices for Prismic Localization

Prismic is a headless Content Management System (CMS). This means that Prismic is a back-end-only CMS, that acts primarily as a content repository, and makes content accessible via an API, without a built-in front-end or presentation layer.

Prismic has good support for localization. It allows you to enable languages you would like to support and localize. You can also combine this with releases, which allows you to plan your publications, and translations to go live simultaneously.

 

Enabling Locales

After creating a repository in the Prismic dashboard, you will be asked to select a master locale for your content. The master locale is the base for all the translations into other locales. Typically, the master locale is a variation of English, like English (US) or English (GB).

Enabling Locales - Prismic

 

If you need to translate content from your repository into any locale, other than the master, then you must enable the locale by following the next steps:

  • Go to Settings > Translations & locales
  • Click on Select an existing locale from the list or create your own
  • Select the locale you want to add and click on the ‘Add’ button

Multi-languages - Prismic

 

Translating Content

Depending on what locales you have enabled in your repository, you will find them listed in a dropdown at the top of the document list. By switching between each locale, you will be able to see what documents are present in the target locale. Alternatively, you can open the document and check if it is available in other locales by using the dropdown at the top.

After a master document is published, it appears with the “to translate” status in all languages. If you need to translate this document, you can use the copy to another locale feature to create the same document in the target languages. This functionality replicates the structure (fields, slices, and media content) of the document, but does not translate it. You will then need to translate its content in the target locale.

The copy to another locale provides two options:

  • Copy slice structure and assets, will allow you to copy all media taken from the media library and slice structures, without content.
  • Copy all content, will copy all the content of your page from the source locale to the target locale. This option is typically recommended to speed up the process.

Alternatively, you can use scripting to copy multiple documents into multiple locales. This can be done by using the Export and Import functionalities, explained in the Export Content and Import Content sections below.

After you are done copying the English content into the target locales,  you can then translate the content directly from Prismic UI or you can export the content into a file and send it to the translation agency.

 

Export Content

Prismic has a built-in feature that allows you to export all published documents. To use this feature, you must follow the next steps:

  • Open your repository of where the documents that need to be translated are
  • Go to Settings > Import/Export > Export your document
  • Click on the Export your documents button
  • Click the link to download a compressed ZIP file that contains all the published documents (one file in JSON format per document)

This feature is good because you can use it to export all the content at once, but it has a  limitation, that only published documents are exported, and you cannot select which document you want to export (it exports all published documents at once).

 

Import Content

Prismic also provides an import feature that you can use to import translated documents. To do this, you need to make sure the files are named following the proper convention mentioned here ‘Translate Content in Bulk‘, before doing any import. Otherwise, this could overwrite in the wrong locales.

 

Conclusion

Prismic provides good support for localization either by using the UI or the scripting. You can translate all your content by using the built-in features. Keep in mind that the Import/Export feature is only available starting from the medium plan. If you are looking for a headless CMS to host content into multiple locales, Prismic can be a good option for you.

 

References: