-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the l10n check to not do ls
but instead add the list of locales to l10n.toml
#553
Comments
I think @Pike is suggesting something like https://github.com/mozilla-services/screenshots/blob/31447de2260ce452d9b9fb235d9cf8ceb2cc1956/l10n.toml#L7-L80 I'm not sure how Screenshots is managing that list, if it's manual or if there is a script that calculates translation %%s and then gets copy/pasted to that list. There is a rough attempt a script that calculates translation percentages (with minimum threshold) in #550, but we'd still need to run the script regularly and copy-paste the results into the ./l10n.toml file to make sure we are supporting all the latest translations before we push to stage/prod. Current status: $ git rev-parse --short HEAD # 1d212df
$ node l10n-lint
total "en" strings: 263
- cy: 100%
- de: 100%
- en: 100%
- en-CA: 100%
- zh-TW: 100%
- zh-CN: 89%
- cs: 82%
- sl: 54%
- pt-PT: 41%
- es-AR: 32%
- fr: 30%
- sv-SE: 21%
- az: 15%
- sk: 14%
- kab: 12%
- es-CL: 9%
- it: 3%
- es-MX: 2%
- ru: 2% |
If we want to dynamically create the list of locales and stuff them into the l10n.toml file, I found a npm lib @iarna/toml which lets us const fs = require("fs");
const dedent = require("dedent");
const pontoonql = require("pontoonql");
const TOML = require("@iarna/toml");
const copyright = dedent`
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
`;
main("./l10n.toml", "firefox-monitor-website", 80);
async function main(src, project, minimum=80) {
const languages = await pontoonql(project, minimum);
const cfg = loadTOML(src);
cfg.locales = languages.map(({locale}) => locale.code).sort();
cfg.locales.unshift("en");
const text = `${copyright.trim()}\n\n${TOML.stringify(cfg)}`;
fs.writeFileSync(src, text);
}
function loadTOML(p) {
const cfg = fs.readFileSync(p, "utf-8").toString();
return TOML.parse(cfg);
} |
ls
but instead add the list of locales to l10n.ini
ls
but instead add the list of locales to l10n.toml
Pulling this out of l10n launch milestone. We're going to launch with a manually-configured list of supported locales in an environment variable. (See #563) |
Closing since we've redesigned the site and functionality since this was created. If you feel that this is still needed, please let me know. |
We're currently still manually filtering afterward, rather than explicitly enumerating locales in our |
Originally posted by @Pike in #544 (review)
The text was updated successfully, but these errors were encountered: