Hi,
I am trying to understand how the default language works in a checkout extension.
Currently I have a checkout extension that has trouble using the specified default language.
We have a checkout extension that supports various languages and has a en.default.json
file. According to documentation About checkout UI extension localization and as I understand it our en.default.json
file should always be used as the default language. However when we use a shop that has no English language active and uses e.g. German as default shop language the frontend renders an element with the German language instead of English.
Could you please clarify how the default language is determined for rendered elements in a checkout extension?
Best regards
1 Like
Hey @Alexander_Merker!
This is actually expected behavior. The en.default.json
file doesn’t serve as the primary language for your checkout extension but more of a fallback that only gets used when all other language options are exhausted.
To choose a translation, Shopify evaluates locale data in the following order of precedence:
- The customer locale. Example:
de-DE
.
- The non-regional customer locale. Example:
de
.
- The shop locale. Example:
fr-FR
.
- The non-regional shop locale. Example:
fr
.
- The extension’s default locale.
Since your test shop has German as the default language and your extension supports various languages (assuming German is one of them), the extension correctly displays in German. The en.default.json
would only be used if your extension had no German translations available and no other language options matched.
Thank you for the clarification @KyleG-Shopify that this is the intended behavior
1 Like