Skip to content

Commit c640eff

Browse files
authored
Merge pull request #576 from itk-dev/feature/6146-translations-cleanup
Translations cleanup
2 parents beedf7c + 5f640e3 commit c640eff

31 files changed

Lines changed: 2225 additions & 218 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,37 @@ jobs:
186186
- name: Reverse patch
187187
run: |
188188
docker compose exec phpfpm patch --strip=1 --verbose --input=${{ matrix.patch }} --reverse
189+
190+
check-translations:
191+
name: Check translation are up to date
192+
runs-on: ubuntu-latest
193+
steps:
194+
- uses: actions/checkout@v4
195+
- uses: go-task/setup-task@v1
196+
197+
- name: Install site
198+
run: |
199+
docker network create frontend
200+
docker compose pull
201+
docker compose up --detach
202+
203+
# Important: Use --no-interaction to make https://getcomposer.org/doc/06-config.md#discard-changes have effect.
204+
docker compose exec phpfpm composer install --no-interaction
205+
206+
# Install the site
207+
docker compose exec phpfpm vendor/bin/drush site:install --existing-config --yes
208+
209+
- run: |
210+
task translation:extract
211+
212+
# https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#manually-triggered-debug
213+
# Enable tmate debugging if debug logging is enabled (cf.
214+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context)
215+
- name: Setup tmate session
216+
uses: mxschmitt/action-tmate@v3
217+
with:
218+
limit-access-to-actor: false
219+
if: 1 == runner.debug
220+
221+
- run: |
222+
task translation:diff

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ private-files
4545
/playwright/.cache/
4646

4747
config/sync/**/webform.webform.*
48+
*.mo

.woodpecker/prod.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ steps:
2525
pre_up:
2626
- itkdev-docker-compose-server run --rm phpfpm vendor/bin/drush --yes cache:rebuild
2727
- itkdev-docker-compose-server run --rm phpfpm vendor/bin/drush --yes deploy
28+
- itkdev-docker-compose-server run --rm phpfpm vendor/bin/drush --yes locale:check
29+
- itkdev-docker-compose-server run --rm phpfpm vendor/bin/drush --yes locale:update
30+
- itkdev-docker-compose-server run --rm phpfpm vendor/bin/drush --yes cache:rebuild
2831
cron:
2932
cron:
3033
minute: "*/5"

.woodpecker/stg.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ steps:
4040
- docker compose run --rm node npm --prefix web/themes/custom/hoeringsportal install
4141
- docker compose run --rm node npm --prefix web/themes/custom/hoeringsportal run build
4242
- docker compose run --rm node rm -rf web/themes/custom/hoeringsportal/node_modules
43+
# Update translations
44+
- itkdev-docker-compose-server exec phpfpm vendor/bin/drush --yes locale:check
45+
- itkdev-docker-compose-server exec phpfpm vendor/bin/drush --yes locale:update
4346
- itkdev-docker-compose-server exec phpfpm vendor/bin/drush --yes cache:rebuild

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
88

9+
* [PR-576](https://github.com/itk-dev/deltag.aarhus.dk/pull/576)
10+
Updates translations and added translations handling to deployment
911
* [PR-584](https://github.com/itk-dev/deltag.aarhus.dk/pull/584)
1012
Removed field_deskpro_department_id from public_meeting content type
1113

Taskfile.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,45 @@ version: "3"
33
# https://taskfile.dev/usage/#env-files
44
dotenv: [".env.local", ".env"]
55

6+
includes:
7+
translation:
8+
taskfile: ./task/Taskfile.translation.yml
9+
vars:
10+
TRANSLATION_MODULES:
11+
# - aarhus_hero
12+
13+
- hoeringsportal_anonymous_edit
14+
# - hoeringsportal_audit_log
15+
# - hoeringsportal_base_fixtures
16+
- hoeringsportal_citizen_proposal
17+
- hoeringsportal_citizen_proposal_archiving
18+
# - hoeringsportal_config_settings
19+
# - hoeringsportal_content_access
20+
# - hoeringsportal_content_blocks
21+
# - hoeringsportal_data
22+
# - hoeringsportal_deskpro
23+
- hoeringsportal_dialogue
24+
# - hoeringsportal_forms
25+
- hoeringsportal_hearing
26+
# - hoeringsportal_misc
27+
# - hoeringsportal_openid_connect
28+
# - hoeringsportal_project
29+
- hoeringsportal_project_timeline
30+
- hoeringsportal_public_meeting
31+
- hoeringsportal_quicklinks
32+
# - hoeringsportal_test_delta_sync_fixtures
33+
34+
- itk_admin
35+
- itk_admin_links
36+
# - itk_media_entity
37+
38+
TRANSLATION_THEMES:
39+
- hoeringsportal
40+
# - hoeringsportal_admin
41+
42+
TRANSLATION_LANGUAGES:
43+
- da
44+
645
vars:
746
# https://taskfile.dev/reference/templating/
847
BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default "https://deltag.local.itkdev.dk"}}'
@@ -314,18 +353,9 @@ tasks:
314353
translations:import:
315354
cmds:
316355
- task compose -- exec phpfpm bash -c '(cd web && ../vendor/bin/drush locale:import --type=customized --override=all da ../translations/custom-translations.da.po)'
317-
- task drush -- php:eval "var_export(\Drupal::state()->get('locale.translation.formulae', []))"
318-
- 'task drush -- php:eval "var_export(array_map(static fn (\$count) => (new \Drupal\Core\StringTranslation\PluralTranslatableMarkup(\$count, ''1 item'', ''@count items'', options: [''langcode'' => ''da'']))->render(), range(0, 5)));"'
319-
- 'task drush -- php:eval "var_export(array_map(static fn (\$count) => (new \Drupal\Core\StringTranslation\PluralTranslatableMarkup(\$count, ''1 item'', ''@count items'', options: [''langcode'' => ''en'']))->render(), range(0, 5)));"'
320-
silent: true
321-
322-
translations:export:
323-
cmds:
324-
- task compose -- exec phpfpm bash -c '(cd web && ../vendor/bin/drush locale:export da --types=customized > ../translations/custom-translations.da.po)'
325-
# Fix plurals spec in PO file
326-
# https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
327-
# https://www.drupal.org/project/drupal/issues/3496223
328-
- 'task compose -- exec phpfpm sed -i "s/Plural-Forms: nplurals=2; plural=(n > 1);/Plural-Forms: nplurals=2; plural=(n != 1);/" translations/custom-translations.da.po'
356+
- task drush -- locale:check
357+
- task drush -- locale:update
358+
- task drush -- cache:rebuild
329359
silent: true
330360

331361
# Development settings tasks (`/admin/config/development/settings`) (cf. https://www.drupal.org/docs/develop/development-tools/disabling-and-debugging-caching).

composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"drupal/masquerade": "^2.0",
9797
"drupal/webprofiler": "^10.3",
9898
"ergebnis/composer-normalize": "^2.44",
99+
"itk-dev/drupal_translation_extractor": "dev-itk_translation_extractor",
99100
"mglaman/phpstan-drupal": "^1.1",
100101
"phpstan/extension-installer": "^1.2",
101102
"phpstan/phpstan-deprecation-rules": "^1.1",
@@ -187,6 +188,10 @@
187188
}
188189
}
189190
},
191+
"itk-dev/drupal_translation_extractor": {
192+
"type": "vcs",
193+
"url": "https://github.com/itk-dev/drupal_translation_extractor"
194+
},
190195
"// @see web/modules/contrib/search_autocomplete/readme.md": {
191196
"type": "package",
192197
"package": {
@@ -317,6 +322,9 @@
317322
},
318323
"drupal/site_status_message": {
319324
"Add cache support (https://www.drupal.org/project/site_status_message/issues/3497218)": "https://git.drupalcode.org/project/site_status_message/-/merge_requests/8.diff"
325+
},
326+
"vincentlanglet/twig-cs-fixer": {
327+
"Drupal's trans tag has an optional plural tag which conflicts with the trans tag from Symfony's Twig bridge (cf. https://github.com/VincentLanglet/Twig-CS-Fixer/pull/134#issuecomment-1756924889)": "patches/vincentlanglet/twig-cs-fixer/token-parser.patch"
320328
}
321329
},
322330
"scripts": {

0 commit comments

Comments
 (0)