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

Sort Working Files locale-aware #8971

Merged
merged 7 commits into from
Sep 24, 2014
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/extensibility/ExtensionManagerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ define(function (require, exports, module) {
context.translated = true;
context.translatedLangs =
info.metadata.i18n.map(function (value) {
if (value === "root") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a little offtopic, but it normalizes "i18n": ["root"] to "i18n": ["en"] in package.json

value = "en";
}
return { name: LocalizationUtils.getLocalizedLabel(value), locale: value };
})
.sort(function (lang1, lang2) {
Expand Down
5 changes: 3 additions & 2 deletions src/file/FileUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,15 @@ define(function (require, exports, module) {
function compareFilenames(filename1, filename2, extFirst) {
var ext1 = getFileExtension(filename1),
ext2 = getFileExtension(filename2),
cmpExt = ext1.toLocaleLowerCase().localeCompare(ext2.toLocaleLowerCase(), undefined, {numeric: true}),
lang = brackets.getLocale(),
cmpExt = ext1.toLocaleLowerCase().localeCompare(ext2.toLocaleLowerCase(), lang, {numeric: true}),
cmpNames;

if (brackets.platform === "win") {
filename1 = getFilenameWithoutExtension(filename1);
filename2 = getFilenameWithoutExtension(filename2);
}
cmpNames = filename1.toLocaleLowerCase().localeCompare(filename2.toLocaleLowerCase(), undefined, {numeric: true});
cmpNames = filename1.toLocaleLowerCase().localeCompare(filename2.toLocaleLowerCase(), lang, {numeric: true});

return extFirst ? (cmpExt || cmpNames) : (cmpNames || cmpExt);
}
Expand Down
3 changes: 1 addition & 2 deletions src/utils/LocalizationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

/**
* Utilities functions related to localization/i18n
*
*/
define(function (require, exports, module) {
"use strict";
Expand All @@ -37,7 +36,7 @@ define(function (require, exports, module) {
* Converts a language code to its written name, if possible.
* If not possible, the language code is simply returned.
*
* @param {string} locale The two-char language code
* @param {string} locale The two-char language code
* @return {string} The language's name or the given language code
*/
function getLocalizedLabel(locale) {
Expand Down