Mordoc

Navigation Translations

Translate navigation labels for multilingual Mordoc sites.

2 MIN READ

Navigation translations are only needed when your site has more than one language.

If your site only uses content/en/, you can skip this page for now and come back later.

What gets translated

Your navigation files define the structure of the navigation:

Text
config/navigation/sidenav.yaml
config/navigation/topnav.yaml
config/navigation/headernav.yaml

Translation files let you change the visible labels for another language without rebuilding the whole navigation structure from scratch.

Create a translations folder

Navigation translation files live here:

Text
config/navigation/translations/

Create one YAML file for each translated language.

For example, a French translation file would be:

Text
config/navigation/translations/fr.yaml

Add translated labels

Use the original labels as keys, then provide the translated labels as values:

Yaml
Getting Started: Premiers pas
Writing Content: Rediger du contenu
Configuration: Configuration

When Mordoc shows the French version of the site, it can use these translated labels in navigation.

Keep labels matched

The keys in the translation file should match the labels used in your navigation files.

For example, if sidenav.yaml contains:

Yaml
- label: Getting Started
  children:
    - label: Create a Project
      path: /getting-started/create-project

Then the translation file can contain:

Yaml
Getting Started: Premiers pas
Create a Project: Creer un projet

If a label is missing from the translation file, Mordoc can still show the original label.

If you've configured a Footer, its lines are translated in this same file, using the same key-value format. Key on the exact line from footer.yaml, including any [text](url) link syntax:

Yaml
"Powered by [Mordoc](https://mordoc.dev)": "Bereitgestellt von [Mordoc](https://mordoc.dev)"
"[Privacy policy](/privacy)": "[Datenschutzrichtlinie](/privacy)"

Quote both sides when the line contains a link — the same reason footer.yaml itself needs quoting: an unquoted leading [ reads as a YAML list.

Unlike sidenav and topnav paths, which Mordoc prefixes with the language code automatically, a footer line's path is part of the translated string itself. Prefix it by hand for an internal link:

Yaml
"[Privacy policy](/privacy)": "[Politique de confidentialité](/fr/privacy)"

Start with languages first

Navigation translations make the most sense after your site has more than one language folder, such as:

Text
content/
├── en/
└── fr/

If you have not done that yet, start with Languages.

Next step

Configure variables.