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

Translating Language Names #562

Open
nnzv opened this issue Oct 10, 2023 · 2 comments
Open

Translating Language Names #562

nnzv opened this issue Oct 10, 2023 · 2 comments

Comments

@nnzv
Copy link

nnzv commented Oct 10, 2023

Hi there,

I'm using hugo-book theme for personal experiments, and I have a question about translating language names.

Here's what's in my setup:

[languages]
[languages.en]
  languageName = 'English'
  contentDir = 'content.en'
  weight = 1

[languages.es]
  languageName = 'Spanish'
  contentDir = 'content.es'
  weight = 2

When I switch to Spanish, the menu still shows 'Spanish' instead of 'Español' (the translation from English to Spanish).

Is there a way to make it automatically show the right language name based on the chosen language? I think this would make things better for websites with different languages.

@alex-shpak
Copy link
Owner

Hi!
There is no way to do this out of the box, in theory you can pass languageName thought i18n in partials/docs/languages.html as {{ i18n .Language.LanguageName }} and then add translations in i18n folder.
But for me it will be very hard to maintain these translations in theme

@Devarajan89
Copy link

Better you can write Español instead spanish in languageName :)

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

No branches or pull requests

3 participants