Déplace les commandes de traduction à la racine

pull/1843/head
Maxime Quandalle 2021-12-02 12:52:42 +01:00 committed by Maxime Quandalle
parent 7db1a3394e
commit aec7c4321d
7 changed files with 26 additions and 25 deletions

View File

@ -50,6 +50,4 @@ jobs:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
- run: yarn install --frozen-lockfile
- working-directory: site
run: yarn run i18n:rules:check;
yarn run i18n:ui:check
- run: yarn run i18n:check

View File

@ -137,7 +137,7 @@ $ yarn workspace site test:dev-e2e:mycompanyinfrance
Le site est disponible en français, et en anglais sur https://mycompanyinfrance.com
Les traductions se trouvent dans le répertoire `source/locales`.
Les traductions se trouvent dans le répertoire `site/source/locales`.
La librairie utilisée pour la traduction de l'UI est
[react-i18next](https://react.i18next.com/).
@ -150,8 +150,7 @@ Le circle-ci fait une analyse statique du code pour repérer les chaînes non
traduites, dans le moteur et l'UI :
```sh
$ yarn run i18n:rules:check
$ yarn run i18n:ui:check
$ yarn run i18n:check
```
Pour traduire automatiquement les chaînes manquantes via l'api Deepl :
@ -159,6 +158,9 @@ Pour traduire automatiquement les chaînes manquantes via l'api Deepl :
```sh
$ yarn run i18n:rules:translate
$ yarn run i18n:ui:translate
# ou bien pour les deux commandes d'un coup
$ yarn run i18n:translate
```
N'oubliez pas de vérifier sur le diff que rien n'est choquant.

View File

@ -120,7 +120,13 @@
"test:regressions": "yarn workspace modele-social build && jest --silent",
"clean": "yarn workspaces run clean && rimraf node_modules",
"start": "yarn workspace site start",
"moso:up": "yarn workspace modele-social run up && yarn workspace site upgrade modele-social"
"moso:up": "yarn workspace modele-social run up && yarn workspace site upgrade modele-social",
"i18n:check": "yarn run i18n:rules:check && yarn run i18n:ui:check",
"i18n:translate": "yarn run i18n:rules:translate && yarn run i18n:ui:translate",
"i18n:rules:check": "node site/scripts/i18n/check-missing-rule-translation.js",
"i18n:rules:translate": "node site/scripts/i18n/translate-rules.js",
"i18n:ui:check": "yarn run i18next -c site/scripts/i18n/parser.config.js && node site/scripts/i18n/check-missing-UI-translation",
"i18n:ui:translate": "rm -rf site/source/locales/static-analysis-fr.json && yarn run i18next -c site/scripts/i18n/parser.config.js && node site/scripts/i18n/translate-ui.js"
},
"workspaces": [
"modele-social",

View File

@ -141,12 +141,6 @@
"test:dev-e2e:mon-entreprise": "cypress open --browser chromium",
"test:dev-e2e:mycompanyinfrance": "cypress open --browser chromium --config baseUrl=http://localhost:8080/infrance,integrationFolder=cypress/integration/mon-entreprise/english --env language=en",
"test:record-http-calls:mon-entreprise": "cypress run --env record_http=",
"i18n:check": "yarn run i18n:rules:check && yarn run i18n:ui:check",
"i18n:translate": "yarn run i18n:rules:translate && yarn run i18n:ui:translate",
"i18n:rules:check": "node scripts/i18n/check-missing-rule-translation.js",
"i18n:rules:translate": "node scripts/i18n/translate-rules.js",
"i18n:ui:check": "yarn run i18next -c scripts/i18n/parser.config.js && node scripts/i18n/check-missing-UI-translation",
"i18n:ui:translate": "rm -rf source/locales/static-analysis-fr.json && yarn run i18next -c scripts/i18n/parser.config.js && node scripts/i18n/translate-ui.js",
"start": "node dev-server.js",
"serve:dev": "concurrently -k \"yarn run serve:dev:mon-entreprise\" \"yarn run serve:dev:mycompanyinfrance & yarn run serve:dev:publicodes\"",
"serve:dev:mon-entreprise": "PORT=5000 serve --config serve.mon-entreprise.json --no-clipboard",

View File

@ -50,7 +50,7 @@ module.exports = {
// Namespace separator used in your translation keys
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
output: 'source/locales/static-analysis-$LOCALE.json',
output: 'site/source/locales/static-analysis-$LOCALE.json',
// Supports $LOCALE and $NAMESPACE injection
// Supports JSON (.json) and YAML (.yml) file formats
// Where to write the locale files relative to process.cwd()

View File

@ -8,9 +8,9 @@ require('../../../modele-social/build')
let rules = require('../../../modele-social')
let { parse } = require('yaml')
let rulesTranslationPath = path.resolve('source/locales/rules-en.yaml')
let UiTranslationPath = path.resolve('source/locales/ui-en.yaml')
let UiOriginalTranslationPath = path.resolve('source/locales/ui-fr.yaml')
let rulesTranslationPath = path.resolve('site/source/locales/rules-en.yaml')
let UiTranslationPath = path.resolve('site/source/locales/ui-en.yaml')
let UiOriginalTranslationPath = path.resolve('site/source/locales/ui-fr.yaml')
let attributesToTranslate = [
'titre',
@ -94,7 +94,7 @@ function getRulesMissingTranslations() {
const getUiMissingTranslations = () => {
const staticKeys = require(path.resolve(
'source/locales/static-analysis-fr.json'
'site/source/locales/static-analysis-fr.json'
))
const translatedKeys = parse(fs.readFileSync(UiTranslationPath, 'utf-8'))
const originalKeys = parse(

View File

@ -980,10 +980,10 @@ pages:
bibliothèque: "<0>Integrate our calculation library</0><1>If you think that your
website or service would benefit from displaying salary calculations, for
example switching from gross to net salary, good news: all the tax and
contribution calculations behind mycompanyinfrance are free and easily reusable
thanks to the <2>NPM publicodes library</2>.</1><2>How to use this
library?</2><3>All our calculation rules are written in `publicodes`, a
declarative language developed by beta.gouv.fr and the Urssaf to encode
contribution calculations behind mycompanyinfrance are free and easily
reusable thanks to the <2>NPM publicodes library</2>.</1><2>How to use
this library?</2><3>All our calculation rules are written in `publicodes`,
a declarative language developed by beta.gouv.fr and the Urssaf to encode
algorithms of public interest. <2>Learn more about publicodes</2></3><4>To
perform your own calculations, you must install the publicodes
interpreter, download the rules used on my-company, call the evaluation
@ -1054,9 +1054,10 @@ pages:
library: <0>Using the calculation engine</0><1>The entire socio-fiscal
calculation engine developed by Urssaf, freely available in the form
of an NPM library.</1>
description: In addition to the mycompanyinfrance site, we provide free and open source
tools to integrate on your website. You can thus include the tools
created for <1>mycompanyinfrance</1> directly in the usual paths of your users.
description: In addition to the mycompanyinfrance site, we provide free and open
source tools to integrate on your website. You can thus include the
tools created for <1>mycompanyinfrance</1> directly in the usual paths
of your users.
titre: Integrate social security law at the heart of your tools
iframe:
csp-1: <0>The error below that appears in the console is related to the