Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the option to translate menus' names using i18n #378

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RichardAlmanza
Copy link

With this change, we can add in <root-project>/i18n/<desired-language>.yaml the respective menu translation

For example, let's use the exampleSite in this repo

in exampleSite/config.toml I'll use Spanish

defaultContentLanguage = "es"

then I create exampleSite/i18n/es.yaml file, with the following content

- id: menu.home
  translation: Inicio

- id: menu.features
  translation: Caracteristicas

- id: menu.portfolio
  translation: Portafolio

- id: section.about
  translation: Acerca de Nosotros

We only need the identifier property in the menu definition in the configuration, thus to translate more sub menus and items, we can add the property

in exampleSite/config.toml I'll add the property to packages

[[menu.main]]
    name       = "Packages"
    identifier = "item.packages" # new line
    url        = ""
    weight     = 1
    parent     = "section.marketing"

then I'll add the new translation in exampleSite/i18n/es.yaml

- id: item.packages
  translation: Paquetes

When there isn't a translation for an ID, it just keeps the name set in the configuration

Bumps [json5](https://github.com/json5/json5) from 2.2.0 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v2.2.0...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant