Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Multilingual #159

Open
clsty opened this issue Feb 15, 2024 · 10 comments · May be fixed by #177
Open

[Feature request] Multilingual #159

clsty opened this issue Feb 15, 2024 · 10 comments · May be fixed by #177
Labels
enhancement New feature or request
Milestone

Comments

@clsty
Copy link

clsty commented Feb 15, 2024

E.g. a button to switch language.

Reference: https://gohugo.io/content-management/multilingual/

P.S. I love this theme. Not only the nice looking, but also its capability handle complex layout on the page. Thank you for such great work!

@bowman2001 bowman2001 added the enhancement New feature or request label Feb 15, 2024
@bowman2001
Copy link
Owner

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.

@Kariton
Copy link
Contributor

Kariton commented Jul 10, 2024

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:

  • placement of the language selector and related CSS (offset to the bottom, shortcode text placement, hover / select coloring which already does kinda work)
  • mod-resource / page-fallback needs to lookup files in the default language and then in the selected language
    not necessary, does work per default
  • news/_index.md url: / is only allowed in the primary language

@Kariton
Copy link
Contributor

Kariton commented Jul 10, 2024

i 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?

@Kariton
Copy link
Contributor

Kariton commented Jul 10, 2024

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?

@Kariton
Copy link
Contributor

Kariton commented Jul 15, 2024

i have added "i18n" string translations to the theme - those required some minor changes to the template

@bowman2001
Copy link
Owner

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.

@bowman2001
Copy link
Owner

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.

@Kariton
Copy link
Contributor

Kariton commented Jul 16, 2024

I am already in the process to add "i18n" translations. i did not find that many.

@Kariton
Copy link
Contributor

Kariton commented Jul 16, 2024

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)

https://github.com/Kariton/perplexdoc/blob/124687ad47ce858808e9e08c4b21a0bc65cf4db8/config/_default/module.yaml

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.

@Kariton
Copy link
Contributor

Kariton commented Jul 19, 2024

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

@Kariton Kariton linked a pull request Jul 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants