Last active
March 20, 2023 18:34
-
-
Save pdehaan/f5ff9ffa41c7cf1527c4a7165638b471 to your computer and use it in GitHub Desktop.
Comparing Pontoon's https://pontoon.mozilla.org/projects/firefox-accounts/ locales to moment's supported locales. MOVED TO https://github.com/pdehaan/momentjs-locales
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const moment = require("moment") | |
// console.log(moment.locales()); // ["en"] | |
const cp = require("node:child_process"); | |
const fs = require("node:fs"); | |
const path = require("node:path"); | |
let momentLocales = fs | |
.readdirSync("./node_modules/moment/dist/locale") | |
.map((locale) => path.basename(locale, ".js")); | |
momentLocales = new Set(momentLocales); | |
// Fetch all locales (or at least locales with >=10% translations). | |
let fxaLocales = cp.execSync("npx pdehaan/pontoonql firefox-accounts 10"); | |
fxaLocales = JSON.parse(fxaLocales).reduce((acc, { locale, progress }) => { | |
acc[locale.code.toLowerCase()] = progress; | |
return acc; | |
}, {}); | |
for (let locale of Object.keys(fxaLocales).sort()) { | |
if (!momentLocales.has(locale)) { | |
console.error( | |
`moment is missing FxA "${locale}" locale (${Math.round( | |
fxaLocales[locale] | |
)}%)` | |
); | |
process.exitCode = 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
momentLocales: Set(135) { | |
'af', | |
'ar-dz', | |
'ar-kw', | |
'ar-ly', | |
'ar-ma', | |
'ar-sa', | |
'ar-tn', | |
'ar', | |
'az', | |
'be', | |
'bg', | |
'bm', | |
'bn-bd', | |
'bn', | |
'bo', | |
'br', | |
'bs', | |
'ca', | |
'cs', | |
'cv', | |
'cy', | |
'da', | |
'de-at', | |
'de-ch', | |
'de', | |
'dv', | |
'el', | |
'en-au', | |
'en-ca', | |
'en-gb', | |
'en-ie', | |
'en-il', | |
'en-in', | |
'en-nz', | |
'en-sg', | |
'eo', | |
'es-do', | |
'es-mx', | |
'es-us', | |
'es', | |
'et', | |
'eu', | |
'fa', | |
'fi', | |
'fil', | |
'fo', | |
'fr-ca', | |
'fr-ch', | |
'fr', | |
'fy', | |
'ga', | |
'gd', | |
'gl', | |
'gom-deva', | |
'gom-latn', | |
'gu', | |
'he', | |
'hi', | |
'hr', | |
'hu', | |
'hy-am', | |
'id', | |
'is', | |
'it-ch', | |
'it', | |
'ja', | |
'jv', | |
'ka', | |
'kk', | |
'km', | |
'kn', | |
'ko', | |
'ku', | |
'ky', | |
'lb', | |
'lo', | |
'lt', | |
'lv', | |
'me', | |
'mi', | |
'mk', | |
'ml', | |
'mn', | |
'mr', | |
'ms-my', | |
'ms', | |
'mt', | |
'my', | |
'nb', | |
'ne', | |
'nl-be', | |
'nl', | |
'nn', | |
'oc-lnc', | |
'pa-in', | |
'pl', | |
'pt-br', | |
'pt', | |
'ro', | |
'ru', | |
'sd', | |
'se', | |
'si', | |
'sk', | |
'sl', | |
'sq', | |
'sr-cyrl', | |
'sr', | |
'ss', | |
'sv', | |
'sw', | |
'ta', | |
'te', | |
'tet', | |
'tg', | |
'th', | |
'tk', | |
'tl-ph', | |
'tlh', | |
'tr', | |
'tzl', | |
'tzm-latn', | |
'tzm', | |
'ug-cn', | |
'uk', | |
'ur', | |
'uz-latn', | |
'uz', | |
'vi', | |
'x-pseudo', | |
'yo', | |
'zh-cn', | |
'zh-hk', | |
'zh-mo', | |
'zh-tw' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moment is missing FxA "ast" locale (21%) | |
moment is missing FxA "cak" locale (67%) | |
moment is missing FxA "dsb" locale (82%) | |
moment is missing FxA "es-ar" locale (100%) | |
moment is missing FxA "es-cl" locale (100%) | |
moment is missing FxA "es-es" locale (92%) | |
moment is missing FxA "fur" locale (36%) | |
moment is missing FxA "fy-nl" locale (100%) | |
moment is missing FxA "gn" locale (100%) | |
moment is missing FxA "hi-in" locale (32%) | |
moment is missing FxA "hsb" locale (95%) | |
moment is missing FxA "ia" locale (100%) | |
moment is missing FxA "kab" locale (84%) | |
moment is missing FxA "nb-no" locale (54%) | |
moment is missing FxA "ne-np" locale (10%) | |
moment is missing FxA "nn-no" locale (63%) | |
moment is missing FxA "pt-pt" locale (77%) | |
moment is missing FxA "rm" locale (65%) | |
moment is missing FxA "su" locale (37%) | |
moment is missing FxA "sv-se" locale (100%) | |
moment is missing FxA "tt" locale (52%) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment