navidrome / navidrome

๐ŸŽงโ˜๏ธ Your Personal Streaming Service
https://www.navidrome.org
GNU General Public License v3.0
11.8k stars 883 forks source link

Set default language in config file #1561

Closed vitormfgoncalves closed 2 years ago

vitormfgoncalves commented 2 years ago

Is your feature request related to a problem?

Please describe.

Describe the solution you'd like

metalheim commented 2 years ago

Agree! Imho it's a bit of an oversight that this hasn't been done before? And it should be an easy enough change.

b4too commented 2 years ago

I'd love to see that as well :)

deluan commented 2 years ago

Agree! Imho it's a bit of an oversight that this hasn't been done before? And it should be an easy enough change.

It was not an oversight. I tried it before a couple of times, but because the way React-Admin apps are structured, I'd have to add all languages in the final bundle, which would make the initial load larger and slower.

I tried it again and I think I found a good solution. The new config option is DefaultLanguage, and it has to be the 2 letter ISO code for the language (see the list here: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) one of the file names in the resources/i18n. Ex for Chinese Simplified it has to be zh-Hanz (case sensitive)

Please test it and let me know.

metalheim commented 2 years ago

@deluan tested with latest develop branch ba28e9a109fb3bb57233f2b4c6ad8ad95f4c3f86. Works well and as expected.

One thing to add: The new DefaultLanguage setting is case sensitive, only lowercase entries work. f.e. this works: DefaultLanguage="pt" but this doesnt: DefaultLanguage="PT"

Which is fine, just something to be aware of.

deluan commented 2 years ago

One thing to add: The new DefaultLanguage setting is case sensitive, only lowercase entries work.

Fixed. Thanks for testing.

b4too commented 2 years ago

Just tested with latest docker hub release 0.48.0, it works fine with this in the docker compose : ND_DEFAULTLANGUAGE: "fr" Thank you for this :beer:

SoSolife commented 2 years ago

One thing to add: The new DefaultLanguage setting is case sensitive, only lowercase entries work.

Fixed. Thanks for testing.

Thanks for adding the option. However for "zh-Hans" it occurs error that translation(id:zh-hans) not found.

zheyiyuezhuo commented 1 year ago

One thing to add: The new DefaultLanguage setting is case sensitive, only lowercase entries work.

Fixed. Thanks for testing.

Thanks for adding the option. However for "zh-Hans" it occurs error that translation(id:zh-hans) not found.

ๅ›พ็‰‡

You has to be 2 letter ISO code for language . The China`s 2 letter is 'zh' ?

SoSolife commented 1 year ago

One thing to add: The new DefaultLanguage setting is case sensitive, only lowercase entries work.

Fixed. Thanks for testing.

Thanks for adding the option. However for "zh-Hans" it occurs error that translation(id:zh-hans) not found.

ๅ›พ็‰‡

You has to be 2 letter ISO code for language . The China`s 2 letter is 'zh' ?

Unfortuately, it doesn't define in the resources i18n. And the author has restore DefaultLanguage case-sensitiveness here.

YEDEDD commented 1 year ago

I tried ND_DEFAULTLANGUAGE = zh, but the default language was not changed to Chinese, and the others were not successfully changed, and the browser was in seamless mode.

deluan commented 1 year ago

The DefaultLanguage option has to match one of the file names in the resources/i18n folder as @SoSolife mentioned. So for Chinese simplified it has to be zh-Hans, and it is case sensitive.

It is only used for new sessions. So, if you already logged from a browser, it won't use the default anymore.

If you are still having issues with this, please open a new issue in GitHub, as this one is already closed. Thanks!

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.