2022-04-02 13:30:16 +00:00
<!DOCTYPE html>
2022-11-01 01:10:49 +00:00
< html lang = "en" dir = "ltr" >
2022-04-02 13:30:16 +00:00
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0" >
2023-09-26 19:28:12 +00:00
< meta name = "generator" content = "Hugo 0.119.0" >
2023-10-02 09:45:01 +00:00
< meta name = "generator" content = "Relearn 5.22.1+tip" >
2022-04-02 13:30:16 +00:00
< meta name = "description" content = "Documentation for Hugo Relearn Theme" >
2023-10-10 21:22:41 +00:00
< meta name = "author" content = "Sören Weber" >
< meta property = "og:title" content = "Multilingual and i18n" / >
2023-10-10 21:21:09 +00:00
< meta property = "og:description" content = "Documentation for Hugo Relearn Theme" / >
< meta property = "og:type" content = "website" / >
2023-10-11 11:17:41 +00:00
< meta property = "og:url" content = "https://McShelby.github.io/hugo-theme-relearn/cont/i18n/" / > < meta property = "og:image" content = "https://McShelby.github.io/hugo-theme-relearn/images/hero.png" / >
< meta name = "twitter:card" content = "summary_large_image" / >
< meta name = "twitter:image" content = "https://McShelby.github.io/hugo-theme-relearn/images/hero.png" / >
2023-10-10 21:21:09 +00:00
< meta name = "twitter:title" content = "Multilingual and i18n" / >
< meta name = "twitter:description" content = "Documentation for Hugo Relearn Theme" / >
2022-04-02 13:30:16 +00:00
< title > Multilingual and i18n :: Hugo Relearn Theme< / title >
2023-01-25 11:42:06 +00:00
< link href = "https://McShelby.github.io/hugo-theme-relearn/cont/i18n/index.html" rel = "alternate" hreflang = "x-default" >
< link href = "https://McShelby.github.io/hugo-theme-relearn/cont/i18n/index.html" rel = "alternate" hreflang = "en" >
< link href = "https://McShelby.github.io/hugo-theme-relearn/pir/cont/i18n/index.html" rel = "alternate" hreflang = "pir" >
2022-11-15 06:35:08 +00:00
< link href = "https://McShelby.github.io/hugo-theme-relearn/cont/i18n/index.html" rel = "canonical" type = "text/html" title = "Multilingual and i18n :: Hugo Relearn Theme" >
2022-11-06 00:38:34 +00:00
< link href = "../../cont/i18n/index.xml" rel = "alternate" type = "application/rss+xml" title = "Multilingual and i18n :: Hugo Relearn Theme" >
2023-10-11 11:17:41 +00:00
< link href = "../../images/logo.svg?1697023054" rel = "icon" type = "image/svg+xml" >
2022-07-15 13:20:02 +00:00
<!-- https://github.com/filamentgroup/loadCSS/blob/master/README.md#how - to - use -->
2023-10-11 11:17:41 +00:00
< link href = "../../css/fontawesome-all.min.css?1697023055" rel = "stylesheet" media = "print" onload = "this.media='all';this.onload=null;" > < noscript > < link href = "../../css/fontawesome-all.min.css?1697023055" rel = "stylesheet" > < / noscript >
< link href = "../../css/nucleus.css?1697023055" rel = "stylesheet" >
< link href = "../../css/auto-complete.css?1697023055" rel = "stylesheet" media = "print" onload = "this.media='all';this.onload=null;" > < noscript > < link href = "../../css/auto-complete.css?1697023055" rel = "stylesheet" > < / noscript >
< link href = "../../css/perfect-scrollbar.min.css?1697023055" rel = "stylesheet" >
< link href = "../../css/fonts.css?1697023055" rel = "stylesheet" media = "print" onload = "this.media='all';this.onload=null;" > < noscript > < link href = "../../css/fonts.css?1697023055" rel = "stylesheet" > < / noscript >
< link href = "../../css/theme.css?1697023055" rel = "stylesheet" >
< link href = "../../css/theme-auto.css?1697023055" rel = "stylesheet" id = "R-variant-style" >
< link href = "../../css/variant.css?1697023055" rel = "stylesheet" >
< link href = "../../css/print.css?1697023055" rel = "stylesheet" media = "print" >
< link href = "../../css/format-print.css?1697023055" rel = "stylesheet" >
< link href = "../../css/ie.css?1697023055" rel = "stylesheet" >
< script src = "../../js/url.js?1697023055" > < / script >
< script src = "../../js/variant.js?1697023055" > < / script >
2022-04-02 13:30:16 +00:00
< script >
// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:
// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72
2022-11-05 23:35:48 +00:00
window.index_js_url="../../index.search.js";
var root_url="../../";
2022-04-02 13:30:16 +00:00
var baseUri=root_url.replace(/\/$/, '');
// translations
window.T_Copy_to_clipboard = 'Copy to clipboard';
window.T_Copied_to_clipboard = 'Copied to clipboard!';
window.T_Copy_link_to_clipboard = 'Copy link to clipboard';
window.T_Link_copied_to_clipboard = 'Copied link to clipboard!';
2023-09-26 20:26:46 +00:00
window.T_Reset_view = 'Reset view';
2023-10-01 10:25:48 +00:00
window.T_View_reset = 'View reset!';
2022-11-17 21:13:11 +00:00
window.T_No_results_found = 'No results found for \u0022{0}\u0022';
window.T_N_results_found = '{1} results found for \u0022{0}\u0022';
2022-04-02 13:30:16 +00:00
// some further base stuff
var baseUriFull='https:\/\/McShelby.github.io\/hugo-theme-relearn/';
2023-08-12 14:11:21 +00:00
window.variants & & variants.init( [ 'auto', 'relearn-bright', 'relearn-light', 'relearn-dark', 'zen-light', 'zen-dark', 'neon', 'learn', 'blue', 'green', 'red' ] );
2022-04-02 13:30:16 +00:00
< / script >
2022-12-02 15:05:54 +00:00
< style >
2023-09-23 08:19:35 +00:00
#R-body img.bg-white {
2022-12-02 15:05:54 +00:00
background-color: white;
}
< / style >
2022-04-02 13:30:16 +00:00
< / head >
2022-11-15 06:35:08 +00:00
< body class = "mobile-support print disableInlineCopyToClipboard" data-url = "../../cont/i18n/index.html" >
2023-09-23 08:19:35 +00:00
< div id = "R-body" class = "default-animation" >
< div id = "R-body-overlay" > < / div >
< nav id = "R-topbar" >
2023-09-18 18:49:44 +00:00
< div class = "topbar-wrapper" >
2023-09-13 21:30:04 +00:00
< div class = "topbar-sidebar-divider" > < / div >
2023-09-18 18:49:44 +00:00
< div class = "topbar-area topbar-area-start" data-area = "start" >
< div class = "topbar-button topbar-button-sidebar" data-content-empty = "disable" data-width-s = "show" data-width-m = "hide" data-width-l = "hide" >
< button class = "topbar-control" onclick = "toggleNav()" type = "button" title = "Menu (CTRL+ALT+n)" >
2023-09-12 21:10:21 +00:00
< i class = "fa-fw fas fa-bars" > < / i >
< / button >
< / div >
2023-09-13 21:30:04 +00:00
< / div >
2023-09-20 22:28:27 +00:00
< ol class = "topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype = "http://schema.org/BreadcrumbList" > < li
2023-09-26 20:26:46 +00:00
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">< a itemprop = "item" href = "../../cont/index.html" > < span itemprop = "name" > Content< / span > < / a > < meta itemprop = "position" content = "1" > > < / li > < li
2023-09-23 22:28:49 +00:00
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">< span itemprop = "name" > Multilingual and i18n< / span > < meta itemprop = "position" content = "2" > < / li >
2023-09-13 21:30:04 +00:00
< / ol >
2023-09-18 18:49:44 +00:00
< div class = "topbar-area topbar-area-end" data-area = "end" >
2023-09-12 21:19:47 +00:00
< / div >
2022-04-02 13:30:16 +00:00
< / div >
< / nav >
2023-09-23 08:19:35 +00:00
< div id = "R-main-overlay" > < / div >
< main id = "R-body-inner" class = "highlightable default" tabindex = "-1" >
2022-04-02 13:30:16 +00:00
< div class = "flex-block-wrapper" >
2022-11-07 19:58:08 +00:00
< article class = "default" >
2023-05-19 18:46:07 +00:00
< header class = "headline" >
< / header >
2022-11-13 21:34:47 +00:00
< h1 id = "multilingual-and-i18n" > Multilingual and i18n< / h1 >
2022-07-05 22:16:52 +00:00
2022-04-02 13:30:16 +00:00
< p > The Relearn theme is fully compatible with Hugo multilingual mode.< / p >
< ul >
2023-10-02 07:58:37 +00:00
< li > Available languages: Arabic, Simplified Chinese, Traditional Chinese, Czech, Dutch, English, Finnish, French, German, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Polish, Portuguese, Russian, Spanish, Swahili, Turkish, Vietnamese. Feel free to contribute!< / li >
2023-02-09 23:35:46 +00:00
< li > Full support for languages written right to left< / li >
2022-04-02 13:30:16 +00:00
< li > Automatic menu generation from multilingual content< / li >
< li > In-browser language switching< / li >
< / ul >
2023-10-11 11:17:41 +00:00
< p > < a href = "#R-image-450377734f1ef8534410df05898b04d0" class = "lightbox-link" > < img src = "../../cont/i18n/i18n-menu.gif?width=18.75rem" alt = "I18n menu" class = "figure-image bg-white border lightbox noshadow" style = "height: auto; width: 18.75rem;" loading = "lazy" > < / a >
< a href = "javascript:history.back();" class = "lightbox-back" id = "R-image-450377734f1ef8534410df05898b04d0" > < img src = "../../cont/i18n/i18n-menu.gif?width=18.75rem" alt = "I18n menu" class = "lightbox-image bg-white border lightbox noshadow" loading = "lazy" > < / a > < / p >
2022-04-02 13:30:16 +00:00
< h2 id = "basic-configuration" > Basic configuration< / h2 >
2022-12-23 11:24:54 +00:00
< p > After learning < a href = "https://gohugo.io/content-management/multilingual" target = "_blank" > how Hugo handle multilingual websites< / a > , define your languages in your < code > config.toml< / code > file.< / p >
2022-04-02 13:30:16 +00:00
< p > For example with current English and Piratized English website.< / p >
2023-06-03 22:20:43 +00:00
2023-01-25 11:42:06 +00:00
< div class = "box notices cstyle note" >
< div class = "box-label" > < i class = "fa-fw fas fa-exclamation-circle" > < / i > Note< / div >
< div class = "box-content" >
2023-06-04 22:25:27 +00:00
2023-05-17 18:59:44 +00:00
< p > Make sure your default language is defined as the first one in the < code > [languages]< / code > array, as the theme needs to make assumptions on it< / p >
2023-06-03 09:12:46 +00:00
< / div >
2023-01-25 11:42:06 +00:00
< / div >
2023-06-21 23:23:13 +00:00
< div class = "wrap-code highlight" > < pre tabindex = "0" class = "chroma" > < code class = "language-toml" data-lang = "toml" > < span class = "line" > < span class = "cl" > < span class = "c" > # English is the default language< / span >
2022-04-02 13:30:16 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > defaultContentLanguage< / span > < span class = "p" > =< / span > < span class = "s2" > " en" < / span >
< / span > < / span > < span class = "line" > < span class = "cl" >
2023-05-17 18:59:44 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "p" > [< / span > < span class = "nx" > languages< / span > < span class = "p" > ]< / span >
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "p" > [< / span > < span class = "nx" > languages< / span > < span class = "p" > .< / span > < span class = "nx" > en< / span > < span class = "p" > ]< / span >
2022-04-02 13:30:16 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > title< / span > < span class = "p" > =< / span > < span class = "s2" > " Hugo Relearn Theme" < / span >
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > weight< / span > < span class = "p" > =< / span > < span class = "mi" > 1< / span >
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > languageName< / span > < span class = "p" > =< / span > < span class = "s2" > " English" < / span >
< / span > < / span > < span class = "line" > < span class = "cl" >
2023-05-17 18:59:44 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "p" > [< / span > < span class = "nx" > languages< / span > < span class = "p" > .< / span > < span class = "nx" > pir< / span > < span class = "p" > ]< / span >
2022-04-02 13:30:16 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > title< / span > < span class = "p" > =< / span > < span class = "s2" > " Cap' n Hugo Relearrrn Theme" < / span >
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > weight< / span > < span class = "p" > =< / span > < span class = "mi" > 2< / span >
2023-06-21 23:23:13 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > languageName< / span > < span class = "p" > =< / span > < span class = "s2" > " Arrr! Pirrrates" < / span > < / span > < / span > < / code > < / pre > < / div > < p > Then, for each new page, append the < em > id< / em > of the language to the file.< / p >
2022-04-02 13:30:16 +00:00
< ul >
< li > Single file < code > my-page.md< / code > is split in two files:
< ul >
< li > in English: < code > my-page.md< / code > < / li >
< li > in Piratized English: < code > my-page.pir.md< / code > < / li >
< / ul >
< / li >
< li > Single file < code > _index.md< / code > is split in two files:
< ul >
< li > in English: < code > _index.md< / code > < / li >
< li > in Piratized English: < code > _index.pir.md< / code > < / li >
< / ul >
< / li >
< / ul >
2023-06-03 22:20:43 +00:00
2022-05-29 21:00:53 +00:00
< div class = "box notices cstyle info" >
2022-12-01 00:38:08 +00:00
< div class = "box-label" > < i class = "fa-fw fas fa-info-circle" > < / i > Info< / div >
< div class = "box-content" >
2023-06-04 22:25:27 +00:00
2022-04-02 13:30:16 +00:00
< p > Be aware that only translated pages are displayed in menu. It’ s not replaced with default language content.< / p >
2023-06-03 09:12:46 +00:00
< / div >
2022-04-02 13:30:16 +00:00
< / div >
2023-06-03 22:20:43 +00:00
2022-05-29 21:00:53 +00:00
< div class = "box notices cstyle tip" >
2022-12-01 00:38:08 +00:00
< div class = "box-label" > < i class = "fa-fw fas fa-lightbulb" > < / i > Tip< / div >
< div class = "box-content" >
2023-06-04 22:25:27 +00:00
2022-12-23 11:24:54 +00:00
< p > Use < a href = "https://gohugo.io/content-management/multilingual/#translate-your-content" target = "_blank" > slug< / a > frontmatter parameter to translate urls too.< / p >
2023-06-03 09:12:46 +00:00
< / div >
2022-04-02 13:30:16 +00:00
< / div >
2022-06-12 17:25:16 +00:00
< h2 id = "search" > Search< / h2 >
< p > In case each page’ s content is written in one single language only, the above configuration will already configure the site’ s search functionality correctly.< / p >
2023-06-03 22:20:43 +00:00
2022-06-12 17:25:16 +00:00
< div class = "box notices cstyle warning" >
2022-12-01 00:38:08 +00:00
< div class = "box-label" > < i class = "fa-fw fas fa-exclamation-triangle" > < / i > Warning< / div >
< div class = "box-content" >
2023-06-04 22:25:27 +00:00
2023-01-30 17:00:33 +00:00
< p > Although the theme supports a wide variety of supported languages, the site’ s search via the < a href = "https://lunrjs.com" target = "_blank" > Lunr< / a > search library does not.
2022-06-12 17:25:16 +00:00
You’ ll see error reports in your browsers console log for each unsupported language. Currently unsupported are:< / p >
< ul >
2023-01-30 17:00:33 +00:00
< li > Czech< / li >
2022-06-12 17:25:16 +00:00
< li > Indonesian< / li >
2023-06-03 09:12:46 +00:00
< li > Polish< / li >
2023-10-02 07:58:37 +00:00
< li > Swahili< / li >
2022-06-12 17:25:16 +00:00
< / ul >
< / div >
2023-06-03 09:12:46 +00:00
< / div >
2022-06-12 17:25:16 +00:00
< h3 id = "search-with-mixed-language-support" > Search with mixed language support< / h3 >
2022-10-31 14:06:51 +00:00
< p > In case your page’ s content contains text in multiple languages (e.g. you are writing a Russian documentation for your english API), you can add those languages to your < code > config.toml< / code > to broaden search.< / p >
2023-06-21 23:23:13 +00:00
< div class = "wrap-code highlight" > < pre tabindex = "0" class = "chroma" > < code class = "language-toml" data-lang = "toml" > < span class = "line" > < span class = "cl" > < span class = "p" > [< / span > < span class = "nx" > params< / span > < span class = "p" > ]< / span >
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > additionalContentLanguage< / span > < span class = "p" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " en" < / span > < span class = "p" > ]< / span > < / span > < / span > < / code > < / pre > < / div > < p > As this is an array, you can add multiple additional languages.< / p >
2023-06-03 22:20:43 +00:00
2022-06-12 17:25:16 +00:00
< div class = "box notices cstyle note" >
2022-12-01 00:38:08 +00:00
< div class = "box-label" > < i class = "fa-fw fas fa-exclamation-circle" > < / i > Note< / div >
< div class = "box-content" >
2023-06-04 22:25:27 +00:00
2022-10-31 14:06:51 +00:00
< p > Keep in mind that the language code required here, is the base language code. E.g. if you have additional content in < code > zh-CN< / code > , you have to add just < code > zh< / code > to this parameter.< / p >
2023-06-03 09:12:46 +00:00
< / div >
2022-06-12 17:25:16 +00:00
< / div >
2022-04-02 13:30:16 +00:00
< h2 id = "overwrite-translation-strings" > Overwrite translation strings< / h2 >
< p > Translations strings are used for common default values used in the theme (< em > Edit< / em > button, < em > Search placeholder< / em > and so on). Translations are available in English and Piratized English but you may use another language or want to override default values.< / p >
< p > To override these values, create a new file in your local i18n folder < code > i18n/< idlanguage> .toml< / code > and inspire yourself from the theme < code > themes/hugo-theme-relearn/i18n/en.toml< / code > < / p >
< h2 id = "disable-language-switching" > Disable language switching< / h2 >
< p > Switching the language in the browser is a great feature, but for some reasons you may want to disable it.< / p >
< p > Just set < code > disableLanguageSwitchingButton=true< / code > in your < code > config.toml< / code > < / p >
2023-06-21 23:23:13 +00:00
< div class = "wrap-code highlight" > < pre tabindex = "0" class = "chroma" > < code class = "language-toml" data-lang = "toml" > < span class = "line" > < span class = "cl" > < span class = "p" > [< / span > < span class = "nx" > params< / span > < span class = "p" > ]< / span >
2022-10-31 14:06:51 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "c" > # When using multilingual website, disable the switch language button.< / span >
2023-06-21 23:23:13 +00:00
< / span > < / span > < span class = "line" > < span class = "cl" > < span class = "nx" > disableLanguageSwitchingButton< / span > < span class = "p" > =< / span > < span class = "kc" > true< / span > < / span > < / span > < / code > < / pre > < / div >
2022-04-02 13:30:16 +00:00
< footer class = "footline" >
< / footer >
< / article >
2023-05-17 22:13:41 +00:00
2022-04-02 13:30:16 +00:00
< / div >
< / main >
< / div >
2023-10-11 11:17:41 +00:00
< script src = "../../js/clipboard.min.js?1697023055" defer > < / script >
< script src = "../../js/perfect-scrollbar.min.js?1697023055" defer > < / script >
< script src = "../../js/theme.js?1697023055" defer > < / script >
2022-04-02 13:30:16 +00:00
< / body >
< / html >