Skip to content

Commit

Permalink
Compat: Make tests work on Windows with non-English locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Wouter van Vliet (WOU) authored and Wouter van Vliet (WOU) committed Oct 13, 2023
1 parent cce4164 commit 9622fc7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"coverage": "c8 --all --include='src/**/*[.js|.jsx|.ts|.tsx]' --reporter=lcov --reporter=text yarn test",
"test": "mocha -r @babel/register -r @babel/polyfill --recursive test/*.test.js test/**/*.test.js",
"test:cli": "yarn -s build && ./bin/cli.js '**/*.html' -o 'test/manual/$LOCALE/$NAMESPACE.json' && ./bin/cli.js -c test/cli/i18next-parser.config.js && ./bin/cli.js -c test/cli/i18next-parser.config.mjs && ./bin/cli.js -c test/cli/i18next-parser.config.ts && ./bin/cli.js -c test/cli/i18next-parser.config.yaml",
"test:cli": "yarn -s build && node ./bin/cli.js '**/*.html' -o test/manual/$LOCALE/$NAMESPACE.json && node ./bin/cli.js -c test/cli/i18next-parser.config.js && node ./bin/cli.js -c test/cli/i18next-parser.config.mjs && node ./bin/cli.js -c test/cli/i18next-parser.config.ts && node ./bin/cli.js -c test/cli/i18next-parser.config.yaml",
"test:watch": "mocha -r @babel/register -r @babel/polyfill --watch --parallel --recursive",
"watch": "babel src -d dist -w",
"prettify": "prettier --write \"{src,test}/**/*.js\"",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function makeDefaultSort(pluralSeparator) {
return getPluralSuffixPosition(key1) - getPluralSuffixPosition(key2)
}

return singularKey1.localeCompare(singularKey2)
return singularKey1.localeCompare(singularKey2, 'en')
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ describe('parser', () => {

const i18nextParser = new i18nTransform({
output: 'locales/$LOCALE/$NAMESPACE.json',
lineEnding: 'lf',
})
const fakeFile = new Vinyl({
contents: Buffer.from("t('nbsp', 'Oné\\u00A0Twó\\u3000Three Four')"),
Expand Down Expand Up @@ -2339,7 +2340,7 @@ describe('parser', () => {
it('supports sort as a function', (done) => {
let result
const i18nextParser = new i18nTransform({
sort: (a, b) => a.slice(0, -1).localeCompare(b.slice(0, -1)),
sort: (a, b) => a.slice(0, -1).localeCompare(b.slice(0, -1), 'ar'),
locales: ['ar'],
})
const fakeFile = new Vinyl({
Expand Down

0 comments on commit 9622fc7

Please sign in to comment.