Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Sort languages via their display names #7593

Merged
merged 3 commits into from
Apr 23, 2014
Merged

Conversation

marcelgerber
Copy link
Contributor

This fixes #7516.

var langName1 = lang1.label,
langName2 = lang2.label;

return langName1.localeCompare(langName2);
Copy link
Contributor

Choose a reason for hiding this comment

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

@SAplayer I noticed that there are three languages (Ελληνικά, русский and српски) that seem to be in the wrong places. Maybe the first letter in those languages are not the regular ascii latin1 characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I thought about in #7516, and @njx said we should do it either way.
Btw, I just looked up the Google language switching page. Click Show more and you'll see the same order (issues).

E: I just saw the chars you wrote are looking like latin chars, but they are not. It's Ε U+0395, р U+0440 and с U+0441.

@redmunds
Copy link
Contributor

Is there a reason that italiano, norsk, polski, and suomi are not capitalized?

@TomMalbran
Copy link
Contributor

I think that English should be sorted to, so that we have English (US) and English (UK) together.

@marcelgerber
Copy link
Contributor Author

@redmunds Looks like it's intended to do so - take a look at https://www.google.com/preferences#languages.

@TomMalbran Don't know what to do here, and English (UK) does not yet much in Brackets (basically nothing...).

// sort the languages via their display name
languages.sort(function (lang1, lang2) {
var langName1 = lang1.label,
langName2 = lang2.label;
Copy link
Contributor

Choose a reason for hiding this comment

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

There's really no need to create these vars since they are only used once. Could simply be:

                languages.sort(function (lang1, lang2) {
                    return lang1.label.localeCompare(lang2.label);
                });

@redmunds
Copy link
Contributor

@SAplayer

Looks like it's intended to do so - take a look at https://www.google.com/preferences#languages.

I don't think that's a good example, since some of the ones that we have capitalized are lowercase there. It's not really related to this change, so we don't need to worry about it.

@marcelgerber
Copy link
Contributor Author

@redmunds Changes pushed. We should consider looking at the locale names a second time, Google and Wikipedia state other names sometimes (or other casing). I could do that if you want.

@redmunds
Copy link
Contributor

@TomMalbran

I think that English should be sorted to, so that we have English (US) and English (UK) together.

This dialog was designed to help those translating from English (US) to some other language, so that's why it was placed at the top. This PR is about ordering the other items in the list, so we'll just keep it there for now.

@redmunds
Copy link
Contributor

Looks good. Merging.

redmunds added a commit that referenced this pull request Apr 23, 2014
Sort languages via their display names
@redmunds redmunds merged commit 4a61749 into adobe:master Apr 23, 2014
@marcelgerber marcelgerber deleted the fix-7516 branch April 23, 2014 14:36
@TomMalbran
Copy link
Contributor

In that case, we could place the other English locales at the top too?

@marcelgerber
Copy link
Contributor Author

Well, at least for now English (UK) doesn't differ from English (US) in core. It would be nice to see them beneath each other, but that would possibly require hardcoding en-gb to the top, which isn't the best.

@peterflynn
Copy link
Member

@TomMalbran @SAplayer Actually, do you know why we bother forcing "English (US)" to the top of the list? From a user standpoint, there's nothing special about "English (US)" -- users don't care that it's the "root" language under the hood... (But of course I can see why we'd want "System Default" at the top -- definitely not suggesting changing that).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[I18N] Sorting order is incorrect in Switch language dropdown menu
5 participants