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

Setting up a basic multilingual content management system with goHugo #1143

Merged
merged 2 commits into from
Feb 23, 2024

Conversation

okeul
Copy link
Contributor

@okeul okeul commented Feb 14, 2024

Hello !

The aim was to be able to easily adapt this page to several languages, so I've used the basic language management system offered by goHugo, which works very well with Netlify.

At the moment we only have 2 languages, English and French.

Light mode :
Capture d’écran 2024-02-14 à 09 05 38

Dark mode :
Capture d’écran 2024-02-14 à 00 49 00

It's pretty simple :

  • If you want to modify an existing language, simply go to the corresponding file in the i18n folder, e.g. i18n/en.yml (for english) and modify the contents. If a translation key does not exist, it automatically switches to English content.
    Capture d’écran 2024-02-14 à 01 11 24
    Capture d’écran 2024-02-14 à 01 11 36
  • If you want to add a new language, it's only a 2-step process
    1. In the hugo.toml file, add the new language (in this case, Spanish in 3rd position)
      Capture d’écran 2024-02-14 à 01 14 38
    2. In the i18n folder, add a yml file with the language shortname, for example es.yml (if spanish), and translate each key in this file.
      Capture d’écran 2024-02-14 à 01 16 30

That's it :-)

@borisschapira
Copy link
Contributor

Great idea. Do you need help with something?

@okeul
Copy link
Contributor Author

okeul commented Feb 16, 2024

Great idea. Do you need help with something?

I'm sure there are a few translations to improve, but otherwise it's fine.

@karlgroves karlgroves merged commit 6bc79f0 into karlgroves:develop Feb 23, 2024
1 check passed
@karlgroves karlgroves mentioned this pull request Mar 8, 2024
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.

3 participants