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

Suggestion for multi lang menu #177

Merged
merged 26 commits into from
May 19, 2024
Merged

Suggestion for multi lang menu #177

merged 26 commits into from
May 19, 2024

Conversation

ilja-radusch
Copy link
Contributor

@ilja-radusch ilja-radusch commented Mar 18, 2024

This is a quick suggestion for a language selection menu right below the site menu. This pulls the currently configured languages to display the menu.

Two new site params are used:

language_menu = true
show_current_lang = false

which control the overall rendering of the language menu and whether the current language should be rendered or omitted.

I could not style the language menu any further. Another idea would be to put that into the footer or at the top of the page.

Hope this helps.

@zjedi
Copy link
Owner

zjedi commented Mar 18, 2024

Can you please make changes also to exampleSite so that the feature is demonstrated? It's totally ok if the content is not translated at the moment, but it would be nice to demonstante the feaature and see it also in the netlify pull request preview.

@zjedi
Copy link
Owner

zjedi commented Mar 18, 2024

I can look into styling it further, if you dont mind me contributing to this branch.

@ilja-radusch
Copy link
Contributor Author

ilja-radusch commented Mar 18, 2024 via email

@zjedi
Copy link
Owner

zjedi commented Mar 24, 2024

I quickly checked how this language swithing looks and I'm thinking ...

  1. is it enough to support just two laguages for now? Are two enough for you?
  2. for the future, we will eventually need to support 3+ languages, which involves a dropdown and somewhat more complex logic. But we can do it later when the need arises.

Repository owner deleted a comment from ilja-radusch Mar 24, 2024
@ilja-radusch
Copy link
Contributor Author

ilja-radusch commented Mar 24, 2024 via email

@zjedi
Copy link
Owner

zjedi commented Mar 24, 2024

Thanks, the language switching menu moved toward top right corner looks much better, I think we could have it this way for the moment.
Quick test: There are still some issues with images: cover image, in-content images, quotation marks, icons in contact section (newly available also is footer) Linksto images are somehow broken.

@zjedi zjedi mentioned this pull request Mar 24, 2024
@ilja-radusch
Copy link
Contributor Author

ilja-radusch commented Mar 24, 2024 via email

@zjedi
Copy link
Owner

zjedi commented Apr 1, 2024

Looks much better, we just have to sort out broken images.

@zjedi
Copy link
Owner

zjedi commented May 10, 2024

@ilja-radusch I'm checking out the image problem and I wonder, what is the idea behind moving images from static to assets? Because I can't get the images from assets get properly loaded when internationalized. It does work from static though.

It looks like the global stuff goes under assets, but the i18n content (homepage) needs to either stay in static or be under language-specific folders.

@ilja-radusch
Copy link
Contributor Author

ilja-radusch commented May 11, 2024 via email

@zjedi
Copy link
Owner

zjedi commented May 11, 2024

@ilja-radusch Thanks for explanation. I can see the following way forwards:

A fix for the broken images would be either:

A. move content-related images back to static
Suitable when you want to reuse the same image for all languages.

B. move content-related images to content folders.
Suitable if you have language-dependent variants of the content images.

C. create shortcode for including images from assets
I'm not very fond of this approach, since it's a step away from generic markdown and towards hugo specific code. But I can see some advanced users might like it.

Maybe we can revisit the topic in a separate PR that would be focused on moving these images to assets - I tried and failed to use them from assets folder. Simple (img)[...jpg] in an .md file won't work - but that's a basic image linking feature that should be preserved. I'm not sure why it doesn't work out of the box, but there are others struggling with this, too.

I plan pushing example for both A and B for german language, and moving some of the images back to static. That would unblock merging this feature.

@zjedi
Copy link
Owner

zjedi commented May 11, 2024

Ok, it seems that in the latest 10 versions, this must have changed, I just updated to latest Hugo version (0.125) and getting different results regarding image linking. Previously I was on something like 0.11x

@zjedi zjedi linked an issue May 12, 2024 that may be closed by this pull request
@zjedi
Copy link
Owner

zjedi commented May 12, 2024

@ilja-radusch I've played around with various approaches and documented possible ways of localizing markdown and images.
Local preview does look fine to me, but the Netlify preview won't render the images from assets.
https://deploy-preview-177--hugo-scroll.netlify.app/de/

Have you published your site already somewhere, or do you have it only locally in development?

@zjedi zjedi merged commit 4191af6 into zjedi:master May 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-language support
2 participants