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

Added support for Hugo Multilingual Mode #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0lbap
Copy link

@0lbap 0lbap commented Dec 21, 2023

I added support for both English and French languages. I've followed Hugo's official documentation on multilingual mode closely to implement these changes. However, please feel free to review and provide feedback, as there's always a chance I might have overlooked something or made some typos.

More languages can be added in the config.toml file. The default language is set to English, and you can access the different languages with the URL (for example, the /about page is in English, but /fr/about page is in french).

Template text translation is done through the i18n function, which can be shorten by simply writing T. This uses the i18n/en.toml and i18n/fr.toml translation files (a list of key/value pairs). See this page for more information.

The content directory now contains two directories en and fr, in which the Markdown content is manually translated.

Here are some steps to add a new language :

  1. Declare your new language in config.toml by adding it under the [languages] and defining the contentDir, languageCode, languageName and weight
  2. Create your associated translation file (for example, i18n/fr.toml). You can use the English file as a base
  3. Create your language content directory (for example, content/fr/). You can use the English directory as a base
  4. Now you can start translating !

This marks my first open source contribution, and I'm eager to learn and improve.

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