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

Include languages' translated names in the switcher #245

Merged
merged 5 commits into from
Feb 19, 2025

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Jan 24, 2025

An alternative to #244 (closes #244, #238 if merged).

I think it is cleaner to use a new attribute for the local/translated/native name for each language, rather than overloading the name field. I agree with @encukou that the English name should come first, and that we should not de-emphasise the other name by using brackets for it.

cc @StanFromIreland @rffontenelle @m-aciek as I can't request you as reviewers.

A

@StanFromIreland
Copy link
Contributor

@JulienPalard @oonid @alessandrocucci @cocoatomo @flowdas @zhsj @mattwang44 @egeakman @raulcd

I cannot request reviews. Pining coordianators to settle capitalization.

@StanFromIreland
Copy link
Contributor

Is it overloading the name field? In my opinion this is a little over complicated for static text that can be pre-stored as a string. It has no effect on the end user and is easier for us as the logic is simpler while still being well below 80 chars.

@AA-Turner
Copy link
Member Author

settle capitalization

I'm unsure what you mean here? Language names are proper nouns so must be capitalised. Did you ping people just to check spelling? Just for the future, it may be better to check these questions before pinging lots of people.

A

@encukou
Copy link
Member

encukou commented Jan 24, 2025 via email

@StanFromIreland
Copy link
Contributor

@AA-Turner Apologies, I assumed you had read the long exchange in my PR where this question had been asked. Petr has linked it.

Co-authored-by: Ezio Melotti <[email protected]>
Co-authored-by: Rafael Fontenelle <[email protected]>
@AA-Turner
Copy link
Member Author

Thanks for linking to the thread!

This table from Wikipedia suggests the following translations for languages.

Name Translated name
German Deutsch
Spanish español
French français
Indonesian bahasa Indonesia
Italian italiano; lingua italiana
Polish Język polski
Turkish Türkçe
Ukrainian Українська мова; Українська

Other sources:

  • Spanish (no capitalisation): [ref]
  • French (no capitalisation): [ref]
  • Indonesian (capitalisation): [ref] (unclear if we should use "Indonesia" or "bahasa Indonesia", though -- the latter seems to refer specifically to standard Indonesian.
  • Italian (no capitalisation): [ref]
  • Polish (no capitalisation per @m-aciek): unclear whether to use the "Język" prefix.
  • Turkish (capitalisation): [ref]
  • Ukrainian (no capitalisation): [ref] (this disagrees with the Wikipedia list)

A

Copy link
Contributor

@mattwang44 mattwang44 left a comment

Choose a reason for hiding this comment

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

Here are the common translations of Chinese in other language switches.

Copy link

@raulcd raulcd left a comment

Choose a reason for hiding this comment

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

From the Spanish translation point of view.

@@ -388,7 +395,7 @@ def setup_switchers(
- Cross-link various languages in a language switcher
- Cross-link various versions in a version switcher
"""
language_pairs = sorted((l.tag, l.name) for l in languages if l.in_prod)
language_pairs = sorted((l.tag, l.switcher_label) for l in languages if l.in_prod)
Copy link
Contributor

@m-aciek m-aciek Jan 30, 2025

Choose a reason for hiding this comment

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

I suggest sorting by name/switcher label instead of prioritizing the tag. This way it will be easier to find by English name lexicographically when the list will grow longer.

It will be predictable and natural where to look for a language knowing its English name.

@hugovk
Copy link
Member

hugovk commented Feb 14, 2025

Preview of how this would look by editing this into the HTML:

HTML
<select class="language-select"><option value="en">English</option><option value="es">Spanish | español</option><option value="fr">French | français</option><option value="it">Italian | italiano</option><option value="ja">Japanese | 日本語</option><option value="ko">Korean | 한국어</option><option value="pl">Polish | polski</option><option value="pt-br">Brazilian Portuguese | Português brasileiro</option><option value="tr">Turkish | Türkçe</option><option value="zh-cn">Simplified Chinese | 简体中文</option><option value="zh-tw">Traditional Chinese | 繁體中文</option></select>
Desktop

Before

image image

After

image image

I don't think the mobile preview in Chrome accurately shows the dropdown (it shows it much smaller, so here's just a screenshot of how it is now on my Android.

Mobile

Before

image

@AA-Turner
Copy link
Member Author

Let's go with this as a first step and see how things look.

A

@AA-Turner AA-Turner merged commit 6aa487d into python:main Feb 19, 2025
5 checks passed
@AA-Turner AA-Turner deleted the switchers/lang-local-names branch February 19, 2025 03:23
@AA-Turner
Copy link
Member Author

The switcher box is now much wider (FireFox) -- but unsure if we can style this to fit to the length of the selected option.

image

@hugovk
Copy link
Member

hugovk commented Feb 19, 2025

Looks okay on mobile:

Mobile

After

image

@rffontenelle
Copy link
Contributor

pt_BR is big, I wish sometimes our language was Brazilian 😁

@AA-Turner
Copy link
Member Author

AA-Turner commented Feb 19, 2025

Likewise fine on iOS:

iOS

image

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.

9 participants