-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Sort Working Files locale-aware #8971
Sort Working Files locale-aware #8971
Conversation
@ingorichter Looks like a good enhancement to me. |
@@ -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() === "root" ? "en-us" : brackets.getLocale(), |
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.
I wonder if we should make this a function in LocalizationUtils? May be useful elsewhere.
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.
Yes, that sounds like a good idea. Perhaps there are other use cases for it.
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.
One is probably #8977 :) I'll change it soon.
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.
Oops. I actually found out that brackets.getLocale()
already returns "en" instead of "root"...
6e03d4a
to
e79f51e
Compare
@@ -230,6 +230,9 @@ define(function (require, exports, module) { | |||
context.translated = true; | |||
context.translatedLangs = | |||
info.metadata.i18n.map(function (value) { | |||
if (value === "root") { |
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.
This is a little offtopic, but it normalizes "i18n": ["root"]
to "i18n": ["en"]
in package.json
@marcelgerber could you please add a couple of tests to |
Added unit tests. |
…ocale Conflicts: test/spec/FileUtils-test.js
@@ -182,5 +182,23 @@ define(function (require, exports, module) { | |||
expect(FileUtils.getSmartFileExtension("foo.bar.php.scss.erb")).toBe("php.scss.erb"); | |||
}); | |||
}); | |||
|
|||
describe("compareFilenames", function () { | |||
|
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.
nit: would you mind removing all these empty lines after the describe function? Thanks.
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 actually rather common in the Brackets code...
@marcelgerber I'm done with the review. Looks good to me and is definitely a great improvement. |
@ingorichter I'm done. Please let me know if that newline should be removed. |
@marcelgerber we need to get better with coding and formatting conventions in general. Thanks for changing this. |
Sort Working Files locale-aware
For #8955.
Tested with German and Swedish locale.