Currently, I believe we're manually checking production-ready locales against https://pontoon.mozilla.org/projects/test-pilot-firefox-send/ (sorting by progress to group by 100% complete), then manually updating the package.json's availableLanguges array.
It may be nice to try and find a more automated way. Here's a brief conversation from the #l20n channel on possible solutions:
<pdehaan> Another l20n question, while I wait for GitHub to return from the dead... for https://pontoon.mozilla.org/projects/test-pilot-firefox-send/ we have several locales that are 100% (yay!). Is there an easy way to get that information, an API or something? Or is the best way to determine our production locales to sort the translation % in descending order manually and build the locales list?
<gandalf> pdehaan: stas just got back from PTO and he's working on an API for our l10n infra. It may have an endpoint for that data eventually. but seems like for now manual is the way
<pdehaan> awesome, thanks
<Pike> pdehaan: you can run compare-locales, it comes with json output via --data=json
<pdehaan> Pike: then just loop over summary locale keys and ignore any locales that have a missing or missing_w prop?
<flod> missing would be enough (missing_w = missing words)
<Pike> pdehaan: or some more permissive criteria, but yes
Being the curious lad I am, I hacked this 🗑🔥 code, which seems to work (assuming you have Python compare-locales installed):
const { exec } = require('child_process');
const { availableLanguages } = require('../package.json');
const compareLocales = 'compare-locales l10n.toml . `ls public/locales` --data=json';
exec(compareLocales, (err, stdout, stderr) => {
if (err) {
console.error(err);
process.exit(1);
}
const missingLocales = (current, package) => current.filter(locale => !package.includes(locale));
const { summary } = JSON.parse(stdout);
const locales = Object.keys(summary)
.filter(locale => {
const loc = summary[locale];
const hasMissing = loc.hasOwnProperty('missing');
const hasErrors = loc.hasOwnProperty('errors');
return !hasMissing && !hasErrors;
})
.sort();
console.log("current 100%:", JSON.stringify(locales));
console.log("package.json:", JSON.stringify(availableLanguages.sort()));
console.log("missing prod:", JSON.stringify(missingLocales(locales, availableLanguages).sort()));
});
$ node scripts/get-prod-locales.js
current 100%: ["cs","cy","de","dsb","en-US","fr","fy-NL","hsb","hu","it","ja","kab","ms","nb-NO","nn-NO","pt-BR","pt-PT","ru","sk","sl","sv-SE","zh-CN","zh-TW"]
package.json: ["cs","cy","de","dsb","en-US","fr","fy-NL","hsb","hu","it","ja","kab","ms","pt-PT","sk","sv-SE","zh-CN","zh-TW"]
missing prod: ["nb-NO","nn-NO","pt-BR","ru","sl"]
Currently, I believe we're manually checking production-ready locales against https://pontoon.mozilla.org/projects/test-pilot-firefox-send/ (sorting by progress to group by 100% complete), then manually updating the package.json's
availableLangugesarray.It may be nice to try and find a more automated way. Here's a brief conversation from the #l20n channel on possible solutions:
Being the curious lad I am, I hacked this 🗑🔥 code, which seems to work (assuming you have Python compare-locales installed):