From 3895bf292ade6884224bf9325c20b82bd128a850 Mon Sep 17 00:00:00 2001 From: HF Date: Wed, 13 Dec 2023 01:39:05 +0100 Subject: [PATCH] only extract languages on full builds --- README.md | 9 +++++---- scripts/build.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9c762635..1b61bd12 100644 --- a/README.md +++ b/README.md @@ -256,18 +256,19 @@ If v is set and true for a canvas in the canvas.json, it will be a 3D voxel canv Run `npm run lint:src` to check for code errors and warnings or `npm run lint -- ./your/file.js` to check a single file. -[ttag](https://github.com/ttag-org/ttag/) is used for handling translations. For server-side rendering the `Accept-Language` header gets checked and the first locale used and on-the-fly translated (`src/core/ttag.js` provides the functions for it). On the client-side a seperate bundle for every language gets provided. -The language definitions in `i18n/template.pot` and `i18n/template-ssr.pot` get updated when doing a dev build with +Compile with source-maps and debug options (but only english language) with ``` npm run build:dev ``` -which also only builds the default local in a development environment for debugging. + +[ttag](https://github.com/ttag-org/ttag/) is used for handling translations. For server-side rendering the `Accept-Language` header gets checked and the first locale used and on-the-fly translated (`src/core/ttag.js` provides the functions for it). On the client-side a seperate bundle for every language gets provided. +The language definitions in `i18n/template.pot` and `i18n/template-ssr.pot` get updated when doing a full production build with all languages (`npm run build`)- To build only specific languages, you can define them with the `--langs` flag: ``` -npm run build -- --langs de,tr +npm run build -- --langs de,gr ``` You can use `npm run babel-node ./utils/script.js` to execute a script with local babel (path always relative to the root directory). diff --git a/scripts/build.js b/scripts/build.js index bf941514..dbd3c4eb 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -170,7 +170,7 @@ async function buildProduction() { await compile(clientConfig({ development: false, analyze: false, - extract: true, + extract: (langs === 'all'), locale: avlangs.shift(), clean: true, readonly: false,