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

Titlize language names #17284

Closed
wants to merge 1 commit into from
Closed

Titlize language names #17284

wants to merge 1 commit into from

Conversation

eggplants
Copy link
Contributor

Aligned the case styles of the language names displayed on the language switch buttons.

Before localhost_ (2)
After localhost_ (1)

langs = ["English", "español", "français", "日本語", "português (Brasil)", "українська", "Ελληνικά", "Deutsch", "中文 (简体)", "中文 (繁體)", "русский", "עברית ", "Esperanto"]
for lang in langs: print(lang, "=>", lang.title())
English => English
español => Español
français => Français
日本語 => 日本語
português (Brasil) => Português (Brasil)
українська => Українська
Ελληνικά => Ελληνικά
Deutsch => Deutsch
中文 (简体) => 中文 (简体)
中文 (繁體) => 中文 (繁體)
русский => Русский
עברית  => עברית
Esperanto => Esperanto

@eggplants eggplants requested a review from a team as a code owner December 14, 2024 17:02
Copy link
Member

@miketheman miketheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I think this enforces an English-language construct onto how languages represent themselves.

The babel library is responsible for holding the rules for each language, and offers methods to obtain the languages's name in a localized rule for a given locale, so I think this is currently operating correctly, and shouldn't be changed.

Here's an example for French:

>>> from babel import Locale
>>> Locale.parse("fr").display_name
'français'
>>> Locale.parse("fr").get_display_name("en")
'French'
>>> Locale.parse("fr").get_display_name("fr")
'français'
>>> Locale.parse("fr").get_display_name("de")
'Französisch'

We can see that the default display_name is localized to the language of origin (in this case fr), instead of the currently-viewed language.
I believe this to be the correct behavior, so will close this request.

If you have supporting information as to why this behavior should be changed and applicable to all the languages, even when the locales have changed, supply that here, and we can reopen the request.

@miketheman miketheman closed this Dec 16, 2024
@miketheman miketheman added the i18n Internationalization label Dec 16, 2024
@eggplants
Copy link
Contributor Author

If you have supporting information as to why this behavior should be changed and applicable to all the languages, even when the locales have changed, supply that here, and we can reopen the request.

I am not a native speaker of each language, so I don't know if it is necessary to write in different case, but I have confirmed from the language selectors of supposedly well-known websites in each language that it is OK to start with all uppercase letters.

español

https://administracion.gob.es/pag_Home/index.html
Screenshot_20241217-013030_Chrome

français

https://www.france.fr/fr/
Screenshot_20241217-012454_Chrome

português

https://www.parlamento.pt/sites/en/

Screenshot_20241217-013525_Chrome

українська

https://www.kmu.gov.ua/en

Screenshot_20241217-014136_Chrome

русский

http://en.kremlin.ru/
Screenshot_20241217-014332_Chrome

@eggplants
Copy link
Contributor Author

@miketheman I don't know why the Babel library changes the initial capitalization depending on the locale, but I can see from the aforementioned use cases for each language site that it would look more natural if the language names were unified by starting with all uppercase letters.

@di
Copy link
Member

di commented Dec 16, 2024

I agree that we should defer to whatever Babel does here. Looks like this is the upstream issue, which was closed as "wontfix": python-babel/babel#544

@eggplants
Copy link
Contributor Author

Wouldn't it be acceptable if there was a motive to unify it as a “title case?”

Anyway, if you do not want to add extra processing to the page that is displayed each time it is accessed, or if it is easier to leave it to the library's recommended method, there is no need to make any changes.

Thank you for reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Internationalization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants