0

By default, to get a specific language content, we need to pass the query params for sc_lang as es-MX, fr-FR..ETC (sc_lang="es-MX") in the JSS layout API to get the specific lang contents.

Is there any way to ignore the region and only send the language like sc_lang="es"

https://scdev9.3cm.dev.local/sitecore/api/layout/render/jss?item={8AFD4EBE-1072-4E86-8C33-7F7C8780C36A}&**sc_lang=es**&sc_apikey={03FCC368-DDA2-4B5F-95AB-5DCF35245E16}

3 Answers 3

2

This is not JSS specific but we used this approach in a JSS project.

To ignore the region on the item language version, we changed the language item name and the values of specific fields like Regional Iso Code in the master DB. But then we also had to migrate all the items language field.

This change caused some problems with resolving for example the Display Name or Title field, because the language of the field template has to be with region (that's how Sitecore works, there is no option to change this behavior in the language settings). But the solution for that was to only create the field template in the specific language with region.

0

One of the options with almost minimal effort could be to use Language fallback module where if you set it correctly it will give you back values fallbacking to general language code.

For example you will create content in "es" language. You could chain language fallbacks also so for "es" language, "en" would be fallback. For "es-MX" language, fallback language would be "es".

This would be your chain "es-MX" -> "es" -> "en".

When you ask for es-MX it will fallback to "es" if content not present and it will fallback to "en" if there is even no "es" content.

Therefore you don't need to change anything in JSS, all is needed is to setup language fallback

0

You can create a specific language and set the fallback language value without the region name. and It will work and fallback to es. please check the screenshot of the Arabic language we have created.

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.