1212 PRETIX_URL : ' {{.TASK_PRETIX_URL | default "http://pretix.hoeringsportal.local.itkdev.dk"}}'
1313 PRETIX_ORGANIZER : ' {{.TASK_PRETIX_ORGANIZER | default "dpl-cms"}}'
1414
15- CUSTOM_MODULES :
15+ TRANSLATION_MODULES :
1616 # Run `ls web/modules/custom/*/*.info.yml | xargs basename -s '.info.yml'` to get this list
1717 - aarhus_hero
1818
@@ -40,18 +40,18 @@ vars:
4040 # - itk_media_entity
4141 # - migrate_subject_data
4242
43- CUSTOM_THEMES :
43+ TRANSLATION_THEMES :
4444 # Run `ls web/themes/custom/*/*.info.yml | xargs basename -s '.info.yml'` to get this []
4545 - hoeringsportal
4646
4747 # - hoeringsportal_admin
4848
49- # During testing and development, you can override CUSTOM_MODULES and CUSTOM_THEMES to not process all modules and themes, e.g.
49+ # During testing and development, you can override TRANSLATION_MODULES and TRANSLATION_THEMES to not process all modules and themes, e.g.
5050 #
51- # CUSTOM_MODULES :
51+ # TRANSLATION_MODULES :
5252 # - hoeringsportal_citizen_proposal
5353 #
54- # CUSTOM_THEMES : []
54+ # TRANSLATION_THEMES : []
5555
5656tasks :
5757 default :
@@ -291,13 +291,44 @@ tasks:
291291 - ' 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'
292292 silent : true
293293
294+ translations:diff :
295+ cmds :
296+ # Ignore some PO metadata when git diff'ing, e.g.
297+ #
298+ # "POT-Creation-Date: 2025-03-12 18:18+0100\n"
299+ # "PO-Revision-Date: 2025-03-12 18:18+0100\n"
300+ - git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' web/*/custom/*/translations/*.po translations/*.po
301+
302+ translations:checkout :
303+ cmds :
304+ - git checkout web/*/custom/*/translations/*.po translations/*.po
305+ # https://taskfile.dev/reference/schema#precondition
306+ preconditions :
307+ - sh : task translations:diff
308+ msg : |
309+ Translations seem to have changed.
310+
311+ Run
312+
313+ task translations:diff
314+
315+ to check.
316+
317+ translations:extract :
318+ cmds :
319+ - task drush -- --yes pm:install potx
320+ - task : translations:extract:modules
321+ - task : translations:extract:themes
322+ - task drush -- --yes pm:uninstall potx
323+ silent : true
324+
294325 translations:extract:modules :
295326 cmds :
296327 # https://github.com/go-task/task/discussions/1543
297328 - for :
298329 matrix :
299330 MODULE :
300- ref : .CUSTOM_MODULES
331+ ref : .TRANSLATION_MODULES
301332 LANGUAGE :
302333 - da
303334 cmd : |
@@ -312,7 +343,7 @@ tasks:
312343 - for :
313344 matrix :
314345 THEME :
315- ref : .CUSTOM_THEMES
346+ ref : .TRANSLATION_THEMES
316347 LANGUAGE :
317348 - da
318349 # `drush potx` always writes to web/general.pot, so we move this file
@@ -324,37 +355,6 @@ tasks:
324355 mv web/general.pot web/themes/custom/{{.ITEM.THEME}}/translations/{{.ITEM.THEME}}.{{.ITEM.LANGUAGE}}.po
325356 internal : true
326357
327- translations:diff :
328- cmds :
329- # Ignore some PO metadata when git diff'ing, e.g.
330- #
331- # "POT-Creation-Date: 2025-03-12 18:18+0100\n"
332- # "PO-Revision-Date: 2025-03-12 18:18+0100\n"
333- - git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' web/*/custom/*/translations translations
334-
335- translations:extract :
336- cmds :
337- - task drush -- --yes pm:install potx
338- - task : translations:extract:modules
339- - task : translations:extract:themes
340- - task drush -- --yes pm:uninstall potx
341- silent : true
342-
343- config-translations:export :
344- cmds :
345- - task drush -- config_translation_po:export da > translations/config-translations.da.po
346- # Fix plurals spec in PO file
347- # https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
348- # https://www.drupal.org/project/drupal/issues/3496223
349- - ' task compose -- exec phpfpm sed -i "s/Plural-Forms: nplurals=2; plural=(n > 1);/Plural-Forms: nplurals=2; plural=(n != 1);/" translations/config-translations.da.po'
350- silent : true
351-
352- config-translations:import :
353- cmds :
354- # Note: We use an empty type to import as not-customized.
355- - task drush -- config_translation_po:import --type='' --override=not-customized da ../translations/config-translations.da.po
356- silent : true
357-
358358 # @todo Can we use `drush locale:check` and/or `drush locale:update` to update
359359 # module translations without overriding existing translations?
360360 # @todo Do we want to override (existing) translations?
@@ -363,21 +363,36 @@ tasks:
363363 - for :
364364 matrix :
365365 MODULE :
366- ref : .CUSTOM_MODULES
366+ ref : .TRANSLATION_MODULES
367367 cmd : task drush -- locale:import-all --override=none modules/custom/{{.ITEM.MODULE}}/translations/
368- silent : true
368+ internal : true
369369
370370 translations:import:themes :
371371 cmds :
372372 - for :
373373 matrix :
374374 THEME :
375- ref : .CUSTOM_THEMES
375+ ref : .TRANSLATION_THEMES
376376 cmd : task drush -- locale:import-all --override=none themes/custom/{{.ITEM.THEME}}/translations/
377- silent : true
377+ internal : true
378378
379379 translations:import:all :
380380 cmds :
381381 - task : translations:import:modules
382382 - task : translations:import:themes
383383 silent : true
384+
385+ config-translations:export :
386+ cmds :
387+ - task drush -- config_translation_po:export da > translations/config-translations.da.po
388+ # Fix plurals spec in PO file
389+ # https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
390+ # https://www.drupal.org/project/drupal/issues/3496223
391+ - ' task compose -- exec phpfpm sed -i "s/Plural-Forms: nplurals=2; plural=(n > 1);/Plural-Forms: nplurals=2; plural=(n != 1);/" translations/config-translations.da.po'
392+ silent : true
393+
394+ config-translations:import :
395+ cmds :
396+ # Note: We use an empty type to import as not-customized.
397+ - task drush -- config_translation_po:import --type='' --override=not-customized da ../translations/config-translations.da.po
398+ silent : true
0 commit comments