Translation in CF | Community
Skip to main content
Level 2
November 22, 2024
Solved

Translation in CF

  • November 22, 2024
  • 1 reply
  • 703 views

Is there a way to serve localized content from Content Fragment. For country and language. Like I have an hierarchy us/en/ and I have de/de. Is there any OOB functionality for the same?

Best answer by Madhur-Madan

Hi @shamlikh ,

No problem. In GraphQL, AEM provides a locale parameter that allows you to serve content based on the locale, but not specifically by country. The system processes the hierarchy from the last segment and serves the corresponding content as soon as it identifies a matching locale.

For example, if your content fragment is located under hierarchies such as us/en/ or hk/en/, it will serve the content for the en locale. Similarly, if the hierarchy is de/de/, it will recognize the latter de as the locale and return the content specific to Germany. Even if the hierarchy is in/de/, the system will only consider the latter part of the path and serve content accordingly.

{ carModelList(_locale: "de") { items { modelCd } } }


Thanks,
Madhur Madan

1 reply

Madhur-Madan
Community Advisor
Community Advisor
November 22, 2024

Hi @shamlikh ,

Could you please provide more clarity on if this question is directed towards content rendered via graphQL?

Thanks,
Madhur

ShamliKhAuthor
Level 2
November 22, 2024

Hi @madhur-madan ,

Sorry I might have missed it in my question but yes I want to know from an omnichannel perspective via GraphQL

Thanks,
Shamli

Madhur-Madan
Community Advisor
Madhur-MadanCommunity AdvisorAccepted solution
Community Advisor
November 22, 2024

Hi @shamlikh ,

No problem. In GraphQL, AEM provides a locale parameter that allows you to serve content based on the locale, but not specifically by country. The system processes the hierarchy from the last segment and serves the corresponding content as soon as it identifies a matching locale.

For example, if your content fragment is located under hierarchies such as us/en/ or hk/en/, it will serve the content for the en locale. Similarly, if the hierarchy is de/de/, it will recognize the latter de as the locale and return the content specific to Germany. Even if the hierarchy is in/de/, the system will only consider the latter part of the path and serve content accordingly.

{ carModelList(_locale: "de") { items { modelCd } } }


Thanks,
Madhur Madan