From 2180bae2e0b4f5a5db99b54cf533435bb375539e Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Thu, 14 Nov 2024 15:41:17 -0700 Subject: [PATCH] fix: processing of downloaded translations --- .github/workflows/release.yml | 8 ++++++-- src/l10n/all-messages.json | 6 +++--- src/l10n/compileL10Strings.ts | 7 ++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 186ebb1a..c2d16197 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,8 +24,12 @@ jobs: run: yarn - name: Sync with crowdin - if: github.ref == 'refs/heads/master' - run: yarn strings:sync + run: | + if [ "${{ github.ref }}" = "refs/heads/master" ]; then + yarn strings:sync + else + yarn strings:download + fi - name: Build package run: yarn build diff --git a/src/l10n/all-messages.json b/src/l10n/all-messages.json index 0e2c881a..0560aca8 100644 --- a/src/l10n/all-messages.json +++ b/src/l10n/all-messages.json @@ -238,7 +238,7 @@ "description": "tooltip for the audio play button for talking books" }, "Audio.Pause": { - "message": "Pausa", + "message": "Pausar", "description": "tooltip for the audio (or motion) pause button" }, "Button.Back": { @@ -250,11 +250,11 @@ "description": "tooltip for the button to go show detail view of book" }, "Button.FullScreen": { - "message": "Ecrã inteiro", + "message": "Tela cheia", "description": "tooltip for the display on full screen button" }, "Button.ExitFullScreen": { - "message": "Sair do modo de ecrã inteiro", + "message": "Sair da tela cheia", "description": "tooltip for the exit full screen button" }, "Button.ChooseLanguage": { diff --git a/src/l10n/compileL10Strings.ts b/src/l10n/compileL10Strings.ts index 3b162e98..b4d9aeed 100644 --- a/src/l10n/compileL10Strings.ts +++ b/src/l10n/compileL10Strings.ts @@ -1,4 +1,4 @@ -import glob from "glob"; +import { glob } from "glob"; import fs from "fs"; // This is used at build-time only, called from package.json @@ -8,11 +8,12 @@ import fs from "fs"; function CombineTranslatedMessagesFiles() { // for painful reasons, the stuff we download comes in under "bloom-player/" const pattern = /src\/l10n\/(bloom-player\/)(.*)\/messages.json/; - glob("src/l10n/**/messages.json", (error, files) => { + glob("src/l10n/**/messages.json").then((files) => { + files.sort(); // Sort files in ascending order let output = ""; let langs: string[] = []; files.forEach((filename) => { - const match = pattern.exec(filename); + const match = pattern.exec(filename.replace(/\\/g, "/")); if (match) { const lang = match[2]; if (lang) {