Hinode logo
  • About 
  • Docs 
  • Components 
  • Guides 
  • Releases 
  •  
  •    Toggle theme
    •   Light
    •   Dark
    •   Auto
  •  
    •   Light
    •   Dark
    •   Auto
Docs
    • Introduction
    • Commands
    • Hosting and deployment
    • Upgrading
    • Contribute
    • Troubleshooting
    • Content management
    • Content organization
    • Typography
    • Links and cross-references
    • Images and figures
    • Tables
    • Icons
    • Layout
    • Colors
    • Color modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Args
    • Badge
    • Breadcrumb
    • Button
    • Button group
    • Card
    • Card group
    • Carousel
    • Collapse
    • Command prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and tabs
    • Persona
    • Release
    • Spinner
    • Sub
    • Sup
    • Timeline
    • Toast
    • Tooltip
    • YouTube
    • Overview
    • Styles
    • Scripts
    • Icons
    • Module development
    • Server headers
    • Server-side redirection
    • Credits
    • License
    • Introduction
    • Commands
    • Hosting and deployment
    • Upgrading
    • Contribute
    • Troubleshooting
    • Content management
    • Content organization
    • Typography
    • Links and cross-references
    • Images and figures
    • Tables
    • Icons
    • Layout
    • Colors
    • Color modes
    • Fonts
    • Languages
    • Navigation
    • Documentation
    • Analytics
    • Modules
    • Abbr
    • Accordion
    • Alert
    • Animation
    • Args
    • Badge
    • Breadcrumb
    • Button
    • Button group
    • Card
    • Card group
    • Carousel
    • Collapse
    • Command prompt
    • Docs
    • Example
    • File
    • Icon
    • Image
    • Kbd
    • Link
    • Map
    • Mark
    • Navbar
    • Navs and tabs
    • Persona
    • Release
    • Spinner
    • Sub
    • Sup
    • Timeline
    • Toast
    • Tooltip
    • YouTube
    • Overview
    • Styles
    • Scripts
    • Icons
    • Module development
    • Server headers
    • Server-side redirection
    • Credits
    • License

Languages

Share via
Hinode
Link copied to clipboard

Configure multiple languages to enable multilingual sites.

On this page
 

  • Language configuration
  • Content translation
  • Internationalization
  • Discarding localization

Added in v0.6.0   

Hinode supports Hugo’s multilingual mode  to create websites with multiple languages side by side. The next paragraphs explain how to configure multiple languages, how to provide content translations, and how to define multilingual messages and keywords.

Language configuration  

Define the languages available to your site in the main site configuration. The below configuration shows the default configuration set in config/_default/languages.toml for the English language.

  • config/_default/languages.toml
[en]
    languageName = "English"
    contentDir = "content"
    weight = 1
...

The default behavior is set in config/_default/hugo.toml. For example, you can set the defaultContentLanguageInSubdir to false to remove the language slug /en from your site entirely.

  • config/_default/hugo.toml
languageCode = "en-us"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
...

Content translation  

Hugo supports multiple ways to define translated content. Hinode uses an approach to define translations in separate directories for each language. In the default settings, content for the English language is defined in the folder content/en. It is recommended to use the same filename for each page translation. This enables Hugo to recognize if a page translation is available. Hinode links to this translation in the main navigation bar.

For example, consider the About page. It is available in both English and Dutch. The content files are defined in content/en/about.md and content/nl/about.md. Hugo now recognizes the page is available in two languages. To translate the URL for the Dutch page, a slug is defined the page’s frontmatter:

---
slug: "over-mij"
---

The English page is available by navigating to /en/about and the Dutch translation is available on /nl/over-mij. The main navigation item shows a language switcher for both translations.

Internationalization  

Hinode uses Hugo’s internationalization function  to translate keywords and messages. Translations are available in English, Dutch, and German. For example, the translation for the word about in the Dutch language is defined in i18n/nl.yaml (strictly speaking, it translates to about me).

# Content
- id: about
  translation: "Over mij"

Discarding localization  

The Hinode template  defines two languages by default. Follow the next steps to discard the Dutch language (nl code) entirely:

  • Remove the folder content/nl and its nested content
  • Remove the entire [nl] section in config/_default/languages.toml
  • Remove the file menus.nl.toml section in config/_default/menus
  • Set the value defaultContentLanguageInSubdir to false in config/_default/hugo.toml
Last updated: August 4, 2023 • Convert to link shortcode (494dc38)
On this page
  • Language configuration
  • Content translation
  • Internationalization
  • Discarding localization
Languages
Languages
Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5.
Code licensed MIT, docs CC BY-NC 4.0
Currently v0.22.0-beta6
 
Links
Home 
About 
Docs 
Components 
Releases 
Guides
Getting started 
Developing modules 
Optimization 
Versioning 
Community
Issues   
Discussions   
Contribute 
Hinode
Code copied to clipboard