1313 PRETIX_URL : ' {{.TASK_PRETIX_URL | default "http://pretix.hoeringsportal.local.itkdev.dk"}}'
1414 PRETIX_ORGANIZER : ' {{.TASK_PRETIX_ORGANIZER | default "dpl-cms"}}'
1515
16- CUSTOM_MODULES :
16+ TRANSLATION_MODULES :
1717 # Run `ls web/modules/custom/*/*.info.yml | xargs basename -s '.info.yml'` to get this list
1818 - aarhus_hero
1919
@@ -41,18 +41,18 @@ vars:
4141 # - itk_media_entity
4242 # - migrate_subject_data
4343
44- CUSTOM_THEMES :
44+ TRANSLATION_THEMES :
4545 # Run `ls web/themes/custom/*/*.info.yml | xargs basename -s '.info.yml'` to get this []
4646 - hoeringsportal
4747
4848 # - hoeringsportal_admin
4949
50- # During testing and development, you can override CUSTOM_MODULES and CUSTOM_THEMES to not process all modules and themes, e.g.
50+ # During testing and development, you can override TRANSLATION_MODULES and TRANSLATION_THEMES to not process all modules and themes, e.g.
5151 #
52- # CUSTOM_MODULES :
52+ # TRANSLATION_MODULES :
5353 # - hoeringsportal_citizen_proposal
5454 #
55- # CUSTOM_THEMES : []
55+ # TRANSLATION_THEMES : []
5656
5757tasks :
5858 default :
@@ -302,13 +302,44 @@ tasks:
302302 - ' 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'
303303 silent : true
304304
305+ translations:diff :
306+ cmds :
307+ # Ignore some PO metadata when git diff'ing, e.g.
308+ #
309+ # "POT-Creation-Date: 2025-03-12 18:18+0100\n"
310+ # "PO-Revision-Date: 2025-03-12 18:18+0100\n"
311+ - git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' web/*/custom/*/translations/*.po translations/*.po
312+
313+ translations:checkout :
314+ cmds :
315+ - git checkout web/*/custom/*/translations/*.po translations/*.po
316+ # https://taskfile.dev/reference/schema#precondition
317+ preconditions :
318+ - sh : task translations:diff
319+ msg : |
320+ Translations seem to have changed.
321+
322+ Run
323+
324+ task translations:diff
325+
326+ to check.
327+
328+ translations:extract :
329+ cmds :
330+ - task drush -- --yes pm:install potx
331+ - task : translations:extract:modules
332+ - task : translations:extract:themes
333+ - task drush -- --yes pm:uninstall potx
334+ silent : true
335+
305336 translations:extract:modules :
306337 cmds :
307338 # https://github.com/go-task/task/discussions/1543
308339 - for :
309340 matrix :
310341 MODULE :
311- ref : .CUSTOM_MODULES
342+ ref : .TRANSLATION_MODULES
312343 LANGUAGE :
313344 - da
314345 cmd : |
@@ -323,7 +354,7 @@ tasks:
323354 - for :
324355 matrix :
325356 THEME :
326- ref : .CUSTOM_THEMES
357+ ref : .TRANSLATION_THEMES
327358 LANGUAGE :
328359 - da
329360 # `drush potx` always writes to web/general.pot, so we move this file
@@ -335,37 +366,6 @@ tasks:
335366 mv web/general.pot web/themes/custom/{{.ITEM.THEME}}/translations/{{.ITEM.THEME}}.{{.ITEM.LANGUAGE}}.po
336367 internal : true
337368
338- translations:diff :
339- cmds :
340- # Ignore some PO metadata when git diff'ing, e.g.
341- #
342- # "POT-Creation-Date: 2025-03-12 18:18+0100\n"
343- # "PO-Revision-Date: 2025-03-12 18:18+0100\n"
344- - git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' web/*/custom/*/translations translations
345-
346- translations:extract :
347- cmds :
348- - task drush -- --yes pm:install potx
349- - task : translations:extract:modules
350- - task : translations:extract:themes
351- - task drush -- --yes pm:uninstall potx
352- silent : true
353-
354- config-translations:export :
355- cmds :
356- - task drush -- config_translation_po:export da > translations/config-translations.da.po
357- # Fix plurals spec in PO file
358- # https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
359- # https://www.drupal.org/project/drupal/issues/3496223
360- - ' 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'
361- silent : true
362-
363- config-translations:import :
364- cmds :
365- # Note: We use an empty type to import as not-customized.
366- - task drush -- config_translation_po:import --type='' --override=not-customized da ../translations/config-translations.da.po
367- silent : true
368-
369369 # @todo Can we use `drush locale:check` and/or `drush locale:update` to update
370370 # module translations without overriding existing translations?
371371 # @todo Do we want to override (existing) translations?
@@ -374,21 +374,36 @@ tasks:
374374 - for :
375375 matrix :
376376 MODULE :
377- ref : .CUSTOM_MODULES
377+ ref : .TRANSLATION_MODULES
378378 cmd : task drush -- locale:import-all --override=none modules/custom/{{.ITEM.MODULE}}/translations/
379- silent : true
379+ internal : true
380380
381381 translations:import:themes :
382382 cmds :
383383 - for :
384384 matrix :
385385 THEME :
386- ref : .CUSTOM_THEMES
386+ ref : .TRANSLATION_THEMES
387387 cmd : task drush -- locale:import-all --override=none themes/custom/{{.ITEM.THEME}}/translations/
388- silent : true
388+ internal : true
389389
390390 translations:import:all :
391391 cmds :
392392 - task : translations:import:modules
393393 - task : translations:import:themes
394394 silent : true
395+
396+ config-translations:export :
397+ cmds :
398+ - task drush -- config_translation_po:export da > translations/config-translations.da.po
399+ # Fix plurals spec in PO file
400+ # https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
401+ # https://www.drupal.org/project/drupal/issues/3496223
402+ - ' 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'
403+ silent : true
404+
405+ config-translations:import :
406+ cmds :
407+ # Note: We use an empty type to import as not-customized.
408+ - task drush -- config_translation_po:import --type='' --override=not-customized da ../translations/config-translations.da.po
409+ silent : true
0 commit comments