See http://stackoverflow.com/questions/43149074/jekyll-or-hugo-theme-with-multilanguage-support
Hugo has already a good story for multiple languages, but it could fairly easily be made even more powerful by allowing template overrides per site/language.
Doing large portions of localisation via i18n files can be cumbersome, so to be able to create language-specific layout files/partials/shortcodes would be great.
A simple sample would be:
โโโ _default
โย ย โโโ baseof.html
โย ย โโโ list.html
โย ย โโโ single.html
โโโ _fr
โย ย โโโ _default
โย ย โย ย โโโ list.html
โย ย โโโ index.html
โโโ index.html
In the imaginary site above we have a base template set that is used for all sites/languages, but then we override some of the templates for the French language (fr). This would also work for themes.
I have prefixed the language with "_" to avoid (hopefully) any section collisions.
I've been wishing for exactly this as I've been reworking my site into Hugo. It'd be especially helpful for laying pages out according to different typographic conventions (I'm doing English/Japanese, and CVs are very different across the two).
I thought though, that the simpler way might be to use something like:
โโโ _default
โ โโโ baseof.html
โ โโโ list.html
โ โโโ list.ja.html
โ โโโ single.html
โ โโโ single.ja.html
โโโ index.html
โโโ index.ja.html
Using filename.ja.html or filename-ja.html, etc. That way, the translations sit side-by-side with each other in the same folder, it matches the translated content system, and presumably you could just double the template search paths (eg. from https://gohugo.io/templates/content/#single-page), like so:
TYPE/LAYOUT.LANG.htmlTYPE/LAYOUT.htmlSECTION/LAYOUT.LANG.htmlSECTION/LAYOUT.htmlTYPE/single.LANG.htmlTYPE/single.htmlSECTION/single.LANG.htmlSECTION/single.htmlLANG.htmlTHEME/layouts/TYPE/LAYOUT.LANG.htmlTHEME/layouts/TYPE/LAYOUT.htmlTHEME/layouts/SECTION/LAYOUT.LANG.htmlTHEME/layouts/SECTION/LAYOUT.htmlTHEME/layouts/TYPE/single.LANG.htmlTHEME/layouts/TYPE/single.htmlTHEME/layouts/SECTION/single.LANG.htmlTHEME/layouts/SECTION/single.htmlTHEME/layouts/_default/single.LANG.htmlTHEME/layouts/_default/single.htmlAdditionally, this shouldn't really disrupt any pre-existing sites, and be relatively easy to add in I think.
@ngsctt I agree, that is much simpler than what I suggested.
Most helpful comment
I've been wishing for exactly this as I've been reworking my site into Hugo. It'd be especially helpful for laying pages out according to different typographic conventions (I'm doing English/Japanese, and CVs are very different across the two).
I thought though, that the simpler way might be to use something like:
Using
filename.ja.htmlorfilename-ja.html, etc. That way, the translations sit side-by-side with each other in the same folder, it matches the translated content system, and presumably you could just double the template search paths (eg. from https://gohugo.io/templates/content/#single-page), like so:TYPE/LAYOUT.LANG.htmlTYPE/LAYOUT.htmlSECTION/LAYOUT.LANG.htmlSECTION/LAYOUT.htmlTYPE/single.LANG.htmlTYPE/single.htmlSECTION/single.LANG.htmlSECTION/single.htmlLANG.htmlTHEME/layouts/TYPE/LAYOUT.LANG.htmlTHEME/layouts/TYPE/LAYOUT.htmlTHEME/layouts/SECTION/LAYOUT.LANG.htmlTHEME/layouts/SECTION/LAYOUT.htmlTHEME/layouts/TYPE/single.LANG.htmlTHEME/layouts/TYPE/single.htmlTHEME/layouts/SECTION/single.LANG.htmlTHEME/layouts/SECTION/single.htmlTHEME/layouts/_default/single.LANG.htmlTHEME/layouts/_default/single.htmlAdditionally, this shouldn't really disrupt any pre-existing sites, and be relatively easy to add in I think.