This integration is available from the Pro plan and above.
Use this integration to sync your Contentful data with Lokalise. It's a good idea to use a separate Lokalise project for Contentful data localization. Lokalise can only sync Text, Symbols and RichText (plus assets).
To set up the integration for your project:
Navigate to the Project settings > Integrations.
Click Connect at the required integration.
Authorize via OAuth2.
Once you authorize, the list of spaces and relevant content types will appear.
Your Contentful data will be loaded automatically (you might need to click Reload list to see all the items).
You can find a specific element by using the search box at the top right corner, or use the Filter dropdown to narrow the scope.
Select and download the required content types for further localization by clicking Import selected.
All missing languages will be added to your Lokalise project automatically. By clicking the Import selected button, the chosen items will be connected to translation keys in your project. This process will be performed in the background, and you can check its status on the Activity page:
Please note that if you have already connected certain elements to the translation keys, and would like to update contents for these keys, you have to tick the Overwrite updated translations checkbox before importing:
You may also need to enable the Import references option. What does that mean? If you get an issue "Field is a reference"
it simply means that this item will not be imported on its own as it does not contain any translatable content. However, if you select this item and enable the Import references option then all records referenced from this field will get imported automatically.
Note of character limits
Our integration respects character limits set in Contentful. There are two types of limits: user-defined and system-defined (technical). If a field has user-defined character limit then it will be set for the corresponding translation key on Lokalise. If there's no user-defined limit then technical limit will be applied:
Short text field — 255 characters
Long text field — 50000 characters
Short text, list field — 1000 items per field
Rich Text field — 200 000 characters
Performing translations and managing locales
Your translation data on Lokalise
Let's check how the inserted keys look in Lokalise. I have added a sample Contentful course from the The example project, so the appropriate tags have been linked to the inserted keys:
The following tags are added automatically:
Contentful — refers to the integration itself
Asset — for asset fields only
The key names are generated using following principle:
Entry ID or Asset ID prefixed with
String array index (affects only string arrays)
All of these parts are separated with
A note on target languages
Once the necessary data is imported, you can add the required languages and perform translations.
Please note, target languages must be added in your Contentful project as well. You can do this under the Locales settings by clicking the Add locale button.
Once a language is added in the Contentful settings, you have to connect this language to your data. You have to be sure that an added language has the same ISO codes in both Lokalise and Contentful, so they can be successfully synchronized.
Once the translations are done, select the items you want to export to Contentful and click the Export selected button.
Choose the languages to export and decide whether you'd like to upload empty translations:
The selected languages will be updated in your Contentful project. This process will also happen in the background.
In the case that any changes were made in your Contentful project, you can update the existing Lokalise keys by importing items from Contentful.
Not all entries and their fields can be linked to keys, due to the lack of localization field or invalid types.
If all entry fields are invalid, the whole item is marked as not eligible for linking.
Valid item prerequisites:
Entry must not be archived — archived entries cannot be updated upon export
Entry field must be localized — non-localized fields can't be imported to Lokalise
Valid entry field types:Text — long text fieldSymbol - short textRichText - formatted text
The Lokalise integration works by rendering a proprietary document to HTML for modifications and parsing it back to RichText document for export.
Some objects can be configured as "localized": false, so Contentful assumes that these are not supposed to be localized and these items will not be linked. You need to adjust that parameter in your Contentful content model.