Multilingual an' i18n

Arrr

Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings and stuff.

Th' Relearrrn theme be fully compat'ble wit' Cap'n Hugo multilingual mode.

It provides:

  • Translat'n str'ns fer default values (English, Arabic, Dutch, Piratized English, German, Hindi, Indonesian, Japanese, Piratized English, Portuguese, Russian, Simplified Chinese, Spanish, Turkish). Feel free t' contribute!
  • Automatic menu generat'n from multilingual rrrambl'n
  • In-browser language switch'n

I18n menu

Basic configurat'n

Aft learn'n how Cap'n Hugo handle multilingual websites, define yer languages 'n yer config.toml file.

For example wit' current English an' Piratized English website.

# English be th' default language
defaultContentLanguage = "en"

[Languages]
[Languages.en]
title = "Documentation for Hugo Relearn Theme"
weight = 1
languageName = "English"

[Languages.pir]
title = "Documentat'n fer Cap'n Hugo Relearrrn Theme"
weight = 2
languageName = "Arrr! Pirrrates"

Then, fer each new plank, append th' id o' th' language t' th' file.

  • Single file my-page.md be split 'n two files:
    • 'n English: my-page.md
    • 'n Piratized English: my-page.pir.md
  • Single file _index.md be split 'n two files:
    • 'n English: _index.md
    • 'n Piratized English: _index.pir.md
Ahoi

Be aware that only translated planks be displayed 'n menu. It’s not replaced wit' default language rrrambl'n.

Smarrrt Arrrse

Use slug Front Matter parameter t' translate urls too.

Overwrite translat'n str'ns

Translat'ns str'ns be used fer common default values used 'n th' theme (Edit this plank button, Search placeholder an' so on). Translat'ns be avail'ble 'n English an' Piratized English but ye may use another language or want t' override default values.

T' override these values, create a new file 'n yer local i18n folder i18n/<idlanguage>.toml an' inspire yourself from th' theme themes/hugo-theme-relearn/i18n/en.toml

Dis'ble language switch'n

Switch'n th' language 'n th' browser be a great feature, but fer some reasons ye may want t' dis'ble it.

Just set disableLanguageSwitchingButton=true 'n yer config.toml

[params]
  # When us'n mulitlingual website, dis'ble th' switch language button.
  disableLanguageSwitchingButton = true