Forum Discussion

Nath's avatar
Nath
Guide
7 years ago

choose lang default in custom page

Hello,

In my community multilang, I need to choose lang default in custom page, in custom page i do not find option for language profile defaults (/t5/custom/page/page-id/my-page).

is it possible to set config lang with freemarker in component of my custom page ?
or i can set cookie named "lang_selected" for detect my lang in custom page ?

Thanks,

  • Nath,

    Cookie is the best solution that works to do this, save select lang cookie and use that cookie value in your custom page.

    Or you can use the api to get prefer language setting by user in their profile.

    • Nath's avatar
      Nath
      Guide

      how i can write and read cookie with Freemarker ? i would like save select lang in page initialization config

      Thanks for your help

  • <#assign user_language = settings.name.get("profile.language", "en")!"en"/>

    Falls back to English if it doesn't find anything. Obviously you can change that default to any other language your community supports.