Navigation (Multilingual) - Documentation topics on: crumbtrails,howto,i18n,internationalization,l10n,languages,localization,menus,multilingual,navigation,.

Navigation (Multilingual)

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.

Language variables in English

Language variables in Spanish

2. Edit folder, page and link titles in the Site Browser using the newly created language keys.

Folders in the Site Browser

Replacing the Title in the Folder properties

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.

The new navigation source file in the Site Browser

4. Find $menuItem.title in the newly uploaded navigation source file and replace it with $text.get($menuItem.title).

Updated navigation source code

5. Specify your custom navigation source code:
#set($navigationSourceCode = "/application/navigation/navigation_ml.vtl")
6. The navigation is now translated into the language of the current session:

Navigation bar in English

Navigation bar in Spanish