Changing {{lang}} value in language route collection

As I understand various helpers use the l18n language variable that can be accessed with the handlebar {{lang}} to know in what language to display date formats, localized text and other helper features.

The guide for multi language content[1] says that in order to host content in multiple languages one needs to create collection routes for each language (ex.: /es/, /ru/ etc.) and use a custom template for each. But each of this templates still gets to use the value of {{lang}} that is set in the settings for the main language. Which makes dates and other content that is automatically translated to be in the main language.

Is there a way to set the value of {{lang}} from within a template or routing file?


{{lang}} is deprecated in favour of {{@site.lang}} but I’m not sure it will help you because it’s still a single site-wide value that can’t be changed, the internal internationalisation implementation is currently single-language.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.