Skip to content

Commit

Permalink
Fix wrong intl messages configuration (#75)
Browse files Browse the repository at this point in the history
* Fix wrong intl messages configuration

* Adapt i18n and lint workflow

* Fix wrong path
  • Loading branch information
raphaelblum authored Aug 22, 2024
1 parent f7c0fdd commit 18b5b91
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ jobs:
git config user.name github-actions
git config user.email [email protected]
- name: "Library: Clone translations"
- name: "COMET Library: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-lang
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/admin/lang/comet-lang"

- name: "COMET Brevo Library: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-brevo-module-lang
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ jobs:
git config user.name github-actions
git config user.email [email protected]
- name: "Library: Clone translations"
- name: "COMET Library: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-lang
token: ${{ secrets.GITHUB_TOKEN }}
path: "demo/admin/lang/comet-lang"

- name: "COMET Brevo Library: Clone translations"
uses: actions/checkout@v3
with:
repository: vivid-planet/comet-brevo-module-lang
Expand Down
1 change: 1 addition & 0 deletions demo/admin/intl-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mkdir -p ./lang

git clone https://github.com/vivid-planet/comet-brevo-module-demo-lang lang/comet-brevo-module-demo-lang
git clone https://github.com/vivid-planet/comet-brevo-module-lang.git lang/comet-brevo-module-lang
git clone https://github.com/vivid-planet/comet-lang.git lang/comet-lang
5 changes: 3 additions & 2 deletions demo/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"lint:prettier": "npx prettier --check './**/*.{js,json,md,yml,yaml}'",
"intl:extract": "formatjs extract \"src/**/*.ts*\" --ignore ./**.d.ts --out-file lang-extracted/en.json --format simple",
"intl:compile:comet-brevo-module": "formatjs compile-folder --format simple --ast lang/comet-brevo-module-lang lang-compiled/comet-brevo-module-lang",
"intl:compile:comet-brevo-module-demo": "formatjs compile-folder --format simple --ast lang/comet-brevo-module-demo-lang lang-compiled/comet-brevo-module-demo-lang",
"intl:compile": "run-p intl:compile:comet-brevo-module-demo intl:compile:comet-brevo-module",
"intl:compile:comet-brevo-module-demo": "formatjs compile-folder --format simple --ast lang/comet-brevo-module-demo-lang/admin lang-compiled/comet-brevo-module-demo-lang",
"intl:compile:comet": "formatjs compile-folder --format simple --ast lang/comet-lang lang-compiled/comet-lang",
"intl:compile": "run-p intl:compile:comet intl:compile:comet-brevo-module-demo intl:compile:comet-brevo-module",
"lint:generated-files-not-modified": "$npm_execpath admin-generator && git diff --exit-code HEAD --",
"generate-block-types": "comet generate-block-types --inputs",
"generate-block-types:watch": "chokidar -s \"**/block-meta.json\" -c \"npm run generate-block-types\""
Expand Down
12 changes: 10 additions & 2 deletions demo/admin/src/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ import { ResolvedIntlConfig } from "react-intl";

import project_messages_de from "../lang-compiled/comet-brevo-module-demo-lang/de.json";
import project_messages_en from "../lang-compiled/comet-brevo-module-demo-lang/en.json";
import comet_messages_de from "../lang-compiled/comet-brevo-module-lang/de.json";
import comet_messages_en from "../lang-compiled/comet-brevo-module-lang/en.json";
import comet_brevo_module_messages_de from "../lang-compiled/comet-brevo-module-lang/de.json";
import comet_brevo_module_messages_en from "../lang-compiled/comet-brevo-module-lang/en.json";
import comet_messages_de from "../lang-compiled/comet-lang/de.json";
import comet_messages_en from "../lang-compiled/comet-lang/en.json";

const cometMessages = {
en: comet_messages_en,
de: comet_messages_de,
};

const cometBrevoModuleMessages = {
en: comet_brevo_module_messages_en,
de: comet_brevo_module_messages_de,
};

const projectMessages = {
en: project_messages_en,
de: project_messages_de,
Expand All @@ -18,6 +25,7 @@ const projectMessages = {
export const getMessages = (): ResolvedIntlConfig["messages"] => {
return {
...cometMessages["en"],
...cometBrevoModuleMessages["en"],
...projectMessages["en"],
};
};

0 comments on commit 18b5b91

Please sign in to comment.