Skip to content
Compare
Choose a tag to compare
@konqi konqi released this 09 Nov 17:11

The Phrase API endpoint to download a full locale has a field fallback_locale_id. When a fallback locale id is provided, keys missing in the currently downloaded locale will be taken from the fallback locale.

The API documentation also specifies that when you fetch a list of available locales for a project the response should include the field fallback_locale. The combination of these two facts should allow partial translations for similar locales, like fr-FR and fr-CH. In this case fr-CH would inherit all the keys from fr-FR and you would only define deviant keys in fr-CH.

Sadly, the fallback_locale is currently not returned when listing locales for a project via the API. However the source_locale property, which has the same format, is. To allow behaviour similar-ish to the fallback_locale_id you can now use the option useSourceLocaleAsFallback for pull operations. This will essentially merge the translations via {...sourceLocaleTranslations, ...currentLocaleTranslations}. You can configure both the source locale and the fallback locale in language settings in the Phrase UI.