Skip to main content

Multilingual

The Relearn theme works with Hugo’s multilingual mode.

It supports many languages, including right-to-left languages.

Supported languages
  • Arabic
  • Simplified Chinese
  • Traditional Chinese
  • Czech
  • Danish
  • Dutch
  • English
  • Finnish
  • French
  • German
  • Hindi
  • Hungarian
  • Indonesian
  • Italian
  • Japanese
  • Korean
  • Persian
  • Polish
  • European Portuguese
  • Brazilian Portuguese
  • Romanian
  • Russian
  • Spanish
  • Swahili
  • Turkish
  • Ukrainian
  • Vietnamese

Translation by File Name

Here’s how to make your site multilingual using translations by file name:

  1. Set up languages in your project configuration:

    hugo.
    defaultContentLanguage: en
    languages:
      en:
        label: English
        locale: en
        title: My Website
        weight: 1
      pir:
        direction: rtl
        label: Pirrratish
        locale: art-x-pir
        title: Arrr, my Website
        weight: 2
  2. Duplicate your content files and add language codes to their file names:

    • content
      • log
        • first-day
          • _index.en.md
          • _index.pir.md
        • second-day
          • index.en.md
          • index.pir.md
        • third-day.en.md
        • third-day.pir.md
        • _index.en.md
        • _index.pir.md
      • _index.en.md
      • _index.pir.md
    • themes
      • hugo-theme-relearn
        • …
    • hugo.yaml

Translation by Content Directory

The theme also support translations by content directory which can be configured in a similar way.

  1. Set up languages in your project configuration:

    hugo.
    defaultContentLanguage: en
    languages:
      en:
        contentDir: content/en
        label: English
        locale: en
        title: My Website
        weight: 1
      pir:
        contentDir: content/pir
        direction: rtl
        label: Pirrratish
        locale: art-x-pir
        title: Arrr, my Website
        weight: 2
  2. Duplicate your content files into separate directories named by their language code:

    • content
      • en
        • log
          • first-day
            • _index.md
          • second-day
            • index.md
          • third-day.md
          • _index.md
        • _index.md
      • pir
        • log
          • first-day
            • _index.md
          • second-day
            • index.md
          • third-day.md
          • _index.md
        • _index.md
    • themes
      • hugo-theme-relearn
        • …
    • hugo.yaml

Search Settings

Check the search configuration for multilingual options.

Turn Off Language Switching

Option By default the theme shows a language switcher in the lower part of the menu.

If you want to have more control, where the language switcher is positioned or you want to configure a different icon, see the chapter on sidebar configuration.

To disable the language switcher set disableLanguageSwitchingButton to true

hugo.
params:
  disableLanguageSwitchingButton: true