Skip to content
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

Open
pdehaan opened this issue Oct 23, 2018 · 5 comments
Labels
jira-synced Jira task created for this l10n reopened Old item that still needs work tooling

Comments

@pdehaan
Copy link
Collaborator

pdehaan commented Oct 23, 2018

That's going to make it easier to switch things on, and infer l10n status from the configuration files.

And yes, in bug 1501220 I'm tracking to add validation to that data based on local data.

Originally posted by @Pike in #544 (review)

@pdehaan
Copy link
Collaborator Author

pdehaan commented Oct 23, 2018

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%

@pdehaan
Copy link
Collaborator Author

pdehaan commented Oct 24, 2018

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 .parse() and .stringify() .toml files:

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);
}

@groovecoder groovecoder added this to the l10n Launch milestone Oct 25, 2018
@flodolo flodolo changed the title Change the l10n check to not do ls but instead add the list of locales to l10n.ini Change the l10n check to not do ls but instead add the list of locales to l10n.toml Oct 30, 2018
@groovecoder
Copy link
Member

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)

@groovecoder groovecoder removed this from the l10n Launch milestone Oct 30, 2018
@EMMLynch
Copy link
Collaborator

EMMLynch commented Mar 6, 2024

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.

@EMMLynch EMMLynch closed this as completed Mar 6, 2024
@Vinnl
Copy link
Collaborator

Vinnl commented Mar 7, 2024

We're currently still manually filtering afterward, rather than explicitly enumerating locales in our l10n.toml, so this might still be a good idea to do. (But at this point, we could also just pick this up when it starts to get painful, like we did on Relay.)

@Vinnl Vinnl reopened this Mar 7, 2024
@EMMLynch EMMLynch added reopened Old item that still needs work jira-synced Jira task created for this labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira-synced Jira task created for this l10n reopened Old item that still needs work tooling
Projects
None yet
Development

No branches or pull requests

4 participants