Navigation controls in dotCMS use the titles of Pages and Content to build the navigation displayed to the user. To display navigation in different languages for different users, the titles must be built to pull content names in different languages.
To create a multilingual navigation follow these steps:
1. Create global language variables for folder, page and link names for each language.
We recommend you create each language key using the directory path and including the file name without its extension. For instance, for a page located on this path: /about-us/our-team/who-we-are.html
, use a language key such as: navigation.aboutus.ourteam.whoweare
.
2. Edit folder, page and link titles in the Site Browser using the newly created language keys.
3. Make a copy of the default navigation source code: dotCMS/static/navigation/list_menus.vtl
and upload to the Site Browser as a file, for instance: /application/navigation/list_menus_ml.vtl
.
4. Find $menuItem.title
in the newly uploaded navigation source file and replace it with $text.get($menuItem.title)
.
5. Specify your custom navigation source code:
#set($navigationSourceCode = "/application/navigation/navigation_ml.vtl")
#navigation(2,2)