feat(SW-706): add diff tooling

This commit is contained in:
Michael Zetterberg
2025-04-11 08:53:18 +02:00
parent 35862d03f0
commit 7de46cafa8
3 changed files with 78 additions and 5 deletions

View File

@@ -306,9 +306,18 @@ Extracts the messages from calls to `intl.formatMessage()` and other supported m
Running the following command will generate a JSON file at `./i18n/tooling/extracted.json`. The format of this file is for consumption by Lokalise. This JSON file is what gets uploaded to Lokalise.
```bash
npm run i18n:extract
yarn workspace @scandic-hotels/scandic-web i18n:extract
```
#### Checking for changes between codebase and Lokalise
> _NOTE_: Diff only considers the English language.
It is recommended to download the latest labels from Lokalise to make sure you have the latest before diffing. See below.
- Run the message extraction above.
- Run `yarn workspace @scandic-hotels/scandic-web i18n:diff`
#### Message upload to Lokalise
Set the environment variable `LOKALISE_API_KEY` to the API key for Lokalise.
@@ -318,7 +327,7 @@ Running the following command will upload the JSON file, that was generated by e
It supports the different upload phases from Lokalise meaning that once this command completes the messages are available for translation in Lokalise.
```bash
npm run i18n:upload
yarn workspace @scandic-hotels/scandic-web i18n:upload
```
#### Message download from Lokalise
@@ -330,7 +339,7 @@ Running the following command will download the translated assets from Lokalise
_DOCUMENTATION PENDING FOR FULL WORKFLOW._
```bash
npm run i18n:download
yarn workspace @scandic-hotels/scandic-web i18n:download
```
#### Message compilation
@@ -340,9 +349,15 @@ Compiles the assets that were downloaded from Lokalise into the dictionaries use
_DOCUMENTATION PENDING FOR FULL WORKFLOW._
```bash
npm run i18n:compile
yarn workspace @scandic-hotels/scandic-web i18n:compile
```
#### Convenience script targets
Extract and upload: `yarn workspace @scandic-hotels/scandic-web i18n:push`
Download and compile: `yarn workspace @scandic-hotels/scandic-web i18n:pull`
Extract, upload, download and compile (push && pull): `yarn workspace @scandic-hotels/scandic-web i18n:sync`
### The workflow
We use the following technical stack to handle translations of UI labels.