Skip to content
This repository has been 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

Conversation

marcelgerber
Copy link
Contributor

For #8955.
Tested with German and Swedish locale.

@pthiess
Copy link
Contributor

pthiess commented Sep 5, 2014

@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(),
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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"...

@@ -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

@ingorichter
Copy link
Contributor

@marcelgerber could you please add a couple of tests to FileUtils-tests.js to verify that this fixes #8955? Thanks.

@marcelgerber
Copy link
Contributor Author

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 () {

Copy link
Contributor

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.

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 actually rather common in the Brackets code...

@ingorichter
Copy link
Contributor

@marcelgerber I'm done with the review. Looks good to me and is definitely a great improvement.

@marcelgerber
Copy link
Contributor Author

@ingorichter I'm done. Please let me know if that newline should be removed.

@ingorichter
Copy link
Contributor

@marcelgerber we need to get better with coding and formatting conventions in general. Thanks for changing this.

ingorichter added a commit that referenced this pull request Sep 24, 2014
@ingorichter ingorichter merged commit 9abc718 into adobe:master Sep 24, 2014
@marcelgerber marcelgerber deleted the workingset-sort-locale branch September 24, 2014 19:23
@pthiess pthiess added this to the Release 0.44 milestone Sep 25, 2014
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.

3 participants