diff --git a/.github/workflows/l10n.yml b/.github/workflows/l10n.yml new file mode 100644 index 00000000..8a8abebf --- /dev/null +++ b/.github/workflows/l10n.yml @@ -0,0 +1,19 @@ +name: L10n +on: pull_request + +jobs: + l10n-extract-check: + runs-on: ubuntu-latest + name: Pot check + steps: + - uses: actions/checkout@master + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: npm ci + - name: extract l10n files + run: npm run l10n:extract + - name: Check l10n file changes + run: bash -c "[[ ! \"`git status --porcelain l10n`\" ]] || ( echo 'Uncommited l10n changes. Run `npm l10n:extract`.' && git status && exit 1 )" diff --git a/build/extract-l10n.js b/build/extract-l10n.js index 247e17da..7344fd8d 100644 --- a/build/extract-l10n.js +++ b/build/extract-l10n.js @@ -20,6 +20,6 @@ extractor ]) .parseFilesGlob('./lib/**/*.@(ts|js)'); -extractor.savePotFile('./messages.pot'); +extractor.savePotFile('./l10n/messages.pot'); extractor.printStats(); diff --git a/l10n/messages.pot b/l10n/messages.pot new file mode 100644 index 00000000..eeafaa74 --- /dev/null +++ b/l10n/messages.pot @@ -0,0 +1,3 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" diff --git a/package.json b/package.json index c9407926..849d31c5 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "build": "babel ./lib --out-dir dist --extensions '.ts,.tsx' --source-maps && tsc --emitDeclarationOnly", "build:doc": "typedoc --excludeNotExported --mode file --out dist/doc lib/index.ts && touch dist/doc/.nojekyll", "check-types": "tsc", - "extract-l10n": "node build/extract-l10n.js", "dev": "babel ./lib --out-dir dist --extensions '.ts,.tsx' --watch", + "l10n:extract": "node build/extract-l10n.js", "test": "jest", "test:watch": "jest --watchAll" },