Skip to content

Commit

Permalink
🏗(common) remove localization support (crowdin)
Browse files Browse the repository at this point in the history
Not required for SATOSA, at least for now.
  • Loading branch information
jonathanperret committed Apr 15, 2024
1 parent 7b2b1c9 commit 24399d4
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 248 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/oidc2fer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,54 +127,5 @@ jobs:
# Python's xmlsec requirement
sudo apt-get update -y -q && sudo apt-get install -y -q libxmlsec1-dev
pip install --user .[dev]
- name: Install gettext (required to compile messages)
run: |
sudo apt-get update
sudo apt-get install -y gettext
- name: Generate a MO file from strings extracted from the project
run: python manage.py compilemessages
- name: Run tests
run: ~/.local/bin/pytest -n 2

i18n-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install gettext (required to make messages)
run: |
sudo apt-get update
sudo apt-get install -y gettext
- name: Install Python
uses: actions/setup-python@v3
with:
python-version: '3.11'

- name: Install development dependencies
working-directory: src/backend
run: |
# Python's xmlsec requirement
sudo apt-get update -y -q && sudo apt-get install -y -q libxmlsec1-dev
pip install --user .[dev]
- name: Generate the translation base file
run: ~/.local/bin/django-admin makemessages --keep-pot --all

- name: Load sops secrets
uses: rouja/actions-sops@main
with:
secret-file: .github/workflows/secrets.enc.env
age-key: ${{ secrets.SOPS_PRIVATE }}

- name: Upload files to Crowdin
run: |
docker run \
--rm \
-e CROWDIN_API_TOKEN=$CROWDIN_API_TOKEN \
-e CROWDIN_PROJECT_ID=$CROWDIN_PROJECT_ID \
-e CROWDIN_BASE_PATH=$CROWDIN_BASE_PATH \
-v "${{ github.workspace }}:/app" \
crowdin/cli:3.16.0 \
crowdin upload sources -c /app/crowdin/config.yml
52 changes: 1 addition & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ COMPOSE_EXEC = $(COMPOSE) exec
COMPOSE_EXEC_APP = $(COMPOSE_EXEC) app-dev
COMPOSE_RUN = $(COMPOSE) run --rm
COMPOSE_RUN_APP = $(COMPOSE_RUN) app-dev
COMPOSE_RUN_CROWDIN = $(COMPOSE_RUN) crowdin crowdin
WAIT_DB = @$(COMPOSE_RUN) dockerize -wait tcp://$(DB_HOST):$(DB_PORT) -timeout 60s
WAIT_KC_DB = $(COMPOSE_RUN) dockerize -wait tcp://kc_postgresql:5432 -timeout 60s

Expand All @@ -66,7 +65,6 @@ data/static:
create-env-files: ## Copy the dist env files to env files
create-env-files: \
env.d/development/common \
env.d/development/crowdin \
env.d/development/postgresql \
env.d/development/kc_postgresql
.PHONY: create-env-files
Expand All @@ -78,8 +76,7 @@ bootstrap: \
create-env-files \
build \
run \
migrate \
back-i18n-compile
migrate
.PHONY: bootstrap

# -- Docker/compose
Expand Down Expand Up @@ -170,14 +167,6 @@ superuser: ## Create an admin superuser with password "admin"
@$(MANAGE) createsuperuser --email admin@example.com --password admin
.PHONY: superuser

back-i18n-compile: ## compile the gettext files
@$(MANAGE) compilemessages --ignore="venv/**/*"
.PHONY: back-i18n-compile

back-i18n-generate: ## create the .pot files used for i18n
@$(MANAGE) makemessages -a --keep-pot
.PHONY: back-i18n-generate

shell: ## connect to database shell
@$(MANAGE) shell #_plus
.PHONY: dbshell
Expand All @@ -203,45 +192,6 @@ env.d/development/postgresql:
env.d/development/kc_postgresql:
cp -n env.d/development/kc_postgresql.dist env.d/development/kc_postgresql

# -- Internationalization

env.d/development/crowdin:
cp -n env.d/development/crowdin.dist env.d/development/crowdin

crowdin-download: ## Download translated message from Crowdin
@$(COMPOSE_RUN_CROWDIN) download -c crowdin/config.yml
.PHONY: crowdin-download

crowdin-download-sources: ## Download sources from Crowdin
@$(COMPOSE_RUN_CROWDIN) download sources -c crowdin/config.yml
.PHONY: crowdin-download-sources

crowdin-upload: ## Upload source translations to Crowdin
@$(COMPOSE_RUN_CROWDIN) upload sources -c crowdin/config.yml
.PHONY: crowdin-upload

i18n-compile: ## compile all translations
i18n-compile: \
back-i18n-compile
.PHONY: i18n-compile

i18n-generate: ## create the .pot files and extract frontend messages
i18n-generate: \
back-i18n-generate
.PHONY: i18n-generate

i18n-download-and-compile: ## download all translated messages and compile them to be used by all applications
i18n-download-and-compile: \
crowdin-download \
i18n-compile
.PHONY: i18n-download-and-compile

i18n-generate-and-upload: ## generate source translations for all applications and upload them to Crowdin
i18n-generate-and-upload: \
i18n-generate \
crowdin-upload
.PHONY: i18n-generate-and-upload

# -- Misc
clean: ## restore repository state as it was freshly cloned
git clean -idx
Expand Down
24 changes: 0 additions & 24 deletions crowdin/config.yml

This file was deleted.

9 changes: 0 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ services:
dockerize:
image: jwilder/dockerize

crowdin:
image: crowdin/cli:3.16.0
volumes:
- ".:/app"
env_file:
- env.d/development/crowdin
user: "${DOCKER_USER:-1000}"
working_dir: /app

kc_postgresql:
image: postgres:14.3
platform: linux/amd64
Expand Down
3 changes: 0 additions & 3 deletions env.d/development/crowdin.dist

This file was deleted.

Binary file removed src/backend/locale/fr_FR/LC_MESSAGES/django.mo
Binary file not shown.
112 changes: 0 additions & 112 deletions src/backend/locale/fr_FR/LC_MESSAGES/django.po

This file was deleted.

0 comments on commit 24399d4

Please sign in to comment.