Open clsty opened 5 months ago
Yes, this would be a big improvement. It’s a lot of work and my time in the foreseeable future is very limited. I don’t have much expierience with multilang in Hugo but I know there are going to be some improvements concerning multilang in the coming (big) next release 0.123.0. And maybe someone else want’s to add multilang capability to the templates when this release is availabe... I leave this open to any assignee for now.
Despite the fact that im a absolute CSS noob i gave it a try... At least the button is there - and it works. :D
current iteration works with dropdown and the language shortcode is always visible in the masthead.
all content is saved in corresponding subfolders e.g. content/en
/ content/de
and so on.
https://github.com/Kariton/perplex/tree/i18n-translations
obvious issues i have found:
news/_index.md
url: /
is only allowed in the primary languagei updated the doc pages to work with my updated template as a demo / preview. the only translated thing is the title.
https://github.com/Kariton/perplexdoc/tree/multilang-support
@bowman2001 WDYT?
despite the fact that i cant figure out how to properly css this dropdown menu i think that was somehow to easy and i totally missed something.
what did you had in mind for multilingual support? any template changes? or is it just that simple with hugo nowdays?
i have added "i18n" string translations to the theme - those required some minor changes to the template
Every hard-coded word or phrase in English inside the templates must be replaced by Hugo’s i18n translation function. The placeholder in this function needs translation tables in language-specific files in the (currently missing) i18n
folder of the theme.
This would be a major change to the theme and needs testing. I will create an i18n branch if you would like to contribute to these template changes and translations.
I am already in the process to add "i18n" translations. i did not find that many.
last thing i added today was a text block
"Missing Translation: Unfortunately, this site isn't available in {{ .RequestLang }}. As a fallback, this page is displayed in {{ .DefaultLang }}."
if someone wants to include "default" language posts in other languages they can do so with module:mounts:
(i do it that way)
that text box requires every page to contain a param for its language.
contentlanguage: en
/ contentlanguage: de
because when they are mounted to "close" gaps the "site lang" is then the same where they are mounted. but to differentiate and highlight that this page is not available in the selected language i wanted this block.
i have published my codebase where i currently use a branch of this theme which includes my PRs for the multilanguage setup as well as the currently open robots / sitemap changes.
https://github.com/Kariton/jaspers-it the website is live at https://jaspers.it
despite the missing content you can directly checkout what i have done until now.
The major problem I have is that my CSS skills are basically non-existent. :D
E.g. a button to switch language.
Reference: https://gohugo.io/content-management/multilingual/