-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Sort languages via their display names #7593
Conversation
var langName1 = lang1.label, | ||
langName2 = lang2.label; | ||
|
||
return langName1.localeCompare(langName2); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
Is there a reason that italiano, norsk, polski, and suomi are not capitalized? |
I think that English should be sorted to, so that we have English (US) and English (UK) together. |
@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; |
There was a problem hiding this comment.
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);
});
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. |
@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. |
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. |
Looks good. Merging. |
Sort languages via their display names
In that case, we could place the other English locales at the top too? |
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. |
@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). |
This fixes #7516.