Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Lint en_GB locale
Browse files Browse the repository at this point in the history
The `verify-locales` linter script now lints `en_GB`. Previously it was
ignored, so it had accumulated errors. All errors in this locale file
have been corrected as well.

This locale file is not actually used in the app, it's just present to
enable us to set a different UK-specific store description.

Closes #29965
Gudahtt committed Jan 29, 2025
1 parent a9d90e5 commit 9d4fcb1
Showing 2 changed files with 912 additions and 329 deletions.
1,215 changes: 888 additions & 327 deletions app/_locales/en_GB/messages.json

Large diffs are not rendered by default.

26 changes: 24 additions & 2 deletions development/verify-locale-strings.js
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
//
// //////////////////////////////////////////////////////////////////////////////

const { deepStrictEqual, AssertionError } = require('node:assert/strict');
const fs = require('fs');
const { promisify } = require('util');
const log = require('loglevel');
@@ -117,6 +118,27 @@

async function verifyLocale(code) {
const englishLocale = await getLocale('en');
let failed = false;

try {
// `en_GB` is a special case, added for compliance reasons
// Not used in-app. Should be identical to `en`.
const englishGbLocale = await getLocale('en_GB');
deepStrictEqual(englishLocale, englishGbLocale, 'en_GB should be identical to en');

Check failure on line 127 in development/verify-locale-strings.js

GitHub Actions / Test lint / Test lint

Replace `englishLocale,·englishGbLocale,·'en_GB·should·be·identical·to·en'` with `⏎······englishLocale,⏎······englishGbLocale,⏎······'en_GB·should·be·identical·to·en',⏎····`
} catch (error) {
if (!error instanceof AssertionError) {

Check failure on line 129 in development/verify-locale-strings.js

GitHub Actions / Test lint / Test lint

Unexpected negating the left operand of 'instanceof' operator
throw error;
}

if (fix) {
console.info('Differences detected in `en_GB` local; overwriting')

Check failure on line 134 in development/verify-locale-strings.js

GitHub Actions / Test lint / Test lint

Insert `;`
await writeLocale('en_GB', englishLocale)

Check failure on line 135 in development/verify-locale-strings.js

GitHub Actions / Test lint / Test lint

Insert `;`
} else {
console.error(error);
}
failed = true;
}

const targetLocale = await getLocale(code);

const extraItems = compareLocalesForMissingItems({
@@ -161,10 +183,10 @@
}
await writeLocale(code, newLocale);
}
return true;
failed = true;
}

return false;
return failed;
}

async function verifyEnglishLocale() {

0 comments on commit 9d4fcb1

Please sign in to comment.