🌐(crowdin) make crowdin work with frontend translations
- upload local translation files on push - make crowdin create a pull request when new translations are made through the crowdin website (webhook configured on crowdin-end)
This commit is contained in:
33
.github/workflows/crowdin-download.yml
vendored
Normal file
33
.github/workflows/crowdin-download.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Download Crowdin translations
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
types: [file-fully-translated]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
crowdin:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download Crowdin files
|
||||||
|
uses: crowdin/github-action@v2
|
||||||
|
with:
|
||||||
|
upload_sources: false
|
||||||
|
upload_translations: false
|
||||||
|
download_translations: true
|
||||||
|
localization_branch_name: l10n_crowdin_translations
|
||||||
|
create_pull_request: true
|
||||||
|
pull_request_title: "New Crowdin translations"
|
||||||
|
pull_request_body: "New Crowdin pull request with translations"
|
||||||
|
pull_request_base_branch_name: "main"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||||
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||||
|
CROWDIN_BASE_PATH: ${{ github.workspace }}
|
||||||
20
.github/workflows/meet.yml
vendored
20
.github/workflows/meet.yml
vendored
@@ -218,12 +218,14 @@ jobs:
|
|||||||
run: make frontend-i18n-extract
|
run: make frontend-i18n-extract
|
||||||
|
|
||||||
- name: Upload files to Crowdin
|
- name: Upload files to Crowdin
|
||||||
run: |
|
uses: crowdin/github-action@v2
|
||||||
docker run \
|
with:
|
||||||
--rm \
|
config: crowdin/config.yml
|
||||||
-e CROWDIN_API_TOKEN=$CROWDIN_API_TOKEN \
|
upload_sources: true
|
||||||
-e CROWDIN_PROJECT_ID=$CROWDIN_PROJECT_ID \
|
upload_translations: true
|
||||||
-e CROWDIN_BASE_PATH=$CROWDIN_BASE_PATH \
|
download_translations: false
|
||||||
-v "${{ github.workspace }}:/app" \
|
env:
|
||||||
crowdin/cli:3.16.0 \
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
crowdin upload sources -c /app/crowdin/config.yml
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||||
|
CROWDIN_BASE_PATH: ${{ github.workspace }}
|
||||||
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||||
|
|||||||
18
Makefile
18
Makefile
@@ -229,10 +229,13 @@ crowdin-upload: ## Upload source translations to Crowdin
|
|||||||
@$(COMPOSE_RUN_CROWDIN) upload sources -c crowdin/config.yml
|
@$(COMPOSE_RUN_CROWDIN) upload sources -c crowdin/config.yml
|
||||||
.PHONY: crowdin-upload
|
.PHONY: crowdin-upload
|
||||||
|
|
||||||
|
crowdin-upload-translations: ## Upload translations to Crowdin
|
||||||
|
@$(COMPOSE_RUN_CROWDIN) upload translations -c crowdin/config.yml
|
||||||
|
.PHONY: crowdin-upload-translations
|
||||||
|
|
||||||
i18n-compile: ## compile all translations
|
i18n-compile: ## compile all translations
|
||||||
i18n-compile: \
|
i18n-compile: \
|
||||||
back-i18n-compile \
|
back-i18n-compile
|
||||||
frontend-i18n-compile
|
|
||||||
.PHONY: i18n-compile
|
.PHONY: i18n-compile
|
||||||
|
|
||||||
i18n-generate: ## create the .pot files and extract frontend messages
|
i18n-generate: ## create the .pot files and extract frontend messages
|
||||||
@@ -295,23 +298,16 @@ help:
|
|||||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%-30s$(RESET) %s\n", $$1, $$2}'
|
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%-30s$(RESET) %s\n", $$1, $$2}'
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
||||||
# FIXME : adapt this command
|
frontend-i18n-extract: ## Check the frontend code and generate missing translations keys in translation files
|
||||||
frontend-i18n-extract: ## Extract the frontend translation inside a json to be used for Crowdin
|
cd $(PATH_FRONT) && npm run i18n:extract
|
||||||
cd $(PATH_FRONT) && yarn i18n:extract
|
|
||||||
.PHONY: frontend-i18n-extract
|
.PHONY: frontend-i18n-extract
|
||||||
|
|
||||||
# FIXME : adapt this command
|
|
||||||
frontend-i18n-generate: ## Generate the frontend json files used for Crowdin
|
frontend-i18n-generate: ## Generate the frontend json files used for Crowdin
|
||||||
frontend-i18n-generate: \
|
frontend-i18n-generate: \
|
||||||
crowdin-download-sources \
|
crowdin-download-sources \
|
||||||
frontend-i18n-extract
|
frontend-i18n-extract
|
||||||
.PHONY: frontend-i18n-generate
|
.PHONY: frontend-i18n-generate
|
||||||
|
|
||||||
# FIXME : adapt this command
|
|
||||||
frontend-i18n-compile: ## Format the Crowdin json files used deploy to the apps
|
|
||||||
cd $(PATH_FRONT) && yarn i18n:deploy
|
|
||||||
.PHONY: frontend-i18n-compile
|
|
||||||
|
|
||||||
# -- K8S
|
# -- K8S
|
||||||
build-k8s-cluster: ## build the kubernetes cluster using kind
|
build-k8s-cluster: ## build the kubernetes cluster using kind
|
||||||
./bin/start-kind.sh
|
./bin/start-kind.sh
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Your crowdin's credentials
|
# Your crowdin's credentials
|
||||||
#
|
#
|
||||||
api_token_env: CROWDIN_API_TOKEN
|
api_token_env: CROWDIN_PERSONAL_TOKEN
|
||||||
project_id_env: CROWDIN_PROJECT_ID
|
project_id_env: CROWDIN_PROJECT_ID
|
||||||
base_path_env: CROWDIN_BASE_PATH
|
base_path_env: CROWDIN_BASE_PATH
|
||||||
|
|
||||||
@@ -14,16 +14,17 @@ preserve_hierarchy: true
|
|||||||
#
|
#
|
||||||
# Files configuration
|
# Files configuration
|
||||||
#
|
#
|
||||||
files: [
|
files:
|
||||||
|
[
|
||||||
{
|
{
|
||||||
source : "/backend/locale/django.pot",
|
source: "src/backend/locale/django.pot",
|
||||||
dest: "/backend-meet.pot",
|
dest: "/backend-meet.pot",
|
||||||
translation : "/backend/locale/%locale_with_underscore%/LC_MESSAGES/django.po"
|
translation: "src/backend/locale/%locale_with_underscore%/LC_MESSAGES/django.po",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: "/frontend/packages/i18n/locales/impress/translations-crowdin.json",
|
source: "src/frontend/src/locales/fr/**/*",
|
||||||
dest: "/frontend-impress.json",
|
translation: "src/frontend/src/locales/%two_letters_code%/**/%original_file_name%",
|
||||||
translation: "/frontend/packages/i18n/locales/impress/%two_letters_code%/translations.json",
|
dest: "/%original_file_name%",
|
||||||
skip_untranslated_strings: true,
|
skip_untranslated_strings: true,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ services:
|
|||||||
image: jwilder/dockerize
|
image: jwilder/dockerize
|
||||||
|
|
||||||
crowdin:
|
crowdin:
|
||||||
image: crowdin/cli:3.16.0
|
image: crowdin/cli:4.0.0
|
||||||
volumes:
|
volumes:
|
||||||
- ".:/app"
|
- ".:/app"
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
CROWDIN_API_TOKEN=Your-Api-Token
|
CROWDIN_PERSONAL_TOKEN=Your-Api-Token
|
||||||
CROWDIN_PROJECT_ID=Your-Project-Id
|
CROWDIN_PROJECT_ID=Your-Project-Id
|
||||||
CROWDIN_BASE_PATH=/app/src
|
CROWDIN_BASE_PATH=/app
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"build": "panda codegen && tsc -b && vite build",
|
"build": "panda codegen && tsc -b && vite build",
|
||||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"i18n:extract": "i18next -c i18next-parser.config.json"
|
"i18n:extract": "npx i18next -c i18next-parser.config.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@livekit/components-react": "2.3.3",
|
"@livekit/components-react": "2.3.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user