@@ -31,31 +31,6 @@ tasks:
3131 find translations web/*/custom/* -name '*.*.po' -ls
3232 silent : true
3333
34- diff :
35- desc : " `git diff` all translation files ignoring some date metadata changes"
36- cmds :
37- # Ignore some PO metadata when git diff'ing, e.g.
38- #
39- # "POT-Creation-Date: 2025-03-12 18:18+0100\n"
40- # "PO-Revision-Date: 2025-03-12 18:18+0100\n"
41- - git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' '*.po'
42-
43- checkout :
44- desc : ' `git checkout` all translation file changes if only date metadata is changed (cf. `task {{.TASK | replace ":checkout" ":diff" }}`)'
45- cmds :
46- - git checkout '*.po'
47- # https://taskfile.dev/reference/schema#precondition
48- preconditions :
49- - sh : task {{.TASK | replace ":checkout" ":diff" }}
50- msg : |
51- Translations seem to have changed.
52-
53- Run
54-
55- task {{.TASK | replace ":checkout" ":diff" }}
56-
57- to check.
58-
5934 extract :
6035 cmds :
6136 - task drush -- pm:install drupal_translation_extractor
@@ -76,7 +51,37 @@ tasks:
7651 ref: .TRANSLATION_LANGUAGES
7752 THEME:
7853 ref: .TRANSLATION_THEMES
54+
55+ # Git restore po files that contain only timestamp changes.
56+ - cmd : |
57+ git restore $(comm -23 <(git diff --name-only --ignore-blank-lines '*.po' | sort) <(git diff --name-only --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' '*.po' | sort))
58+
7959 vars :
8060 EXTRACT_COMMAND : task drush -- drupal_translation_extractor:translation:extract --dump-messages --force --sort=asc --output '%source_dir/translations/%project.%language.po' --no-fill {{.CLI_ARGS}}
8161 # EXTRACT_COMMAND: task drush -- drupal_translation_extractor:translation:extract --dump-messages --force --sort=asc --output '%source_dir/translations/%project.%language.po' {{.CLI_ARGS}}
8262 # EXTRACT_COMMAND: task drush -- drupal_translation_extractor:translation:extract --dump-messages --force --sort=asc --output '%source_dir/translations/%project.%language.po' --fill-from-string-storage {{.CLI_ARGS}}
63+
64+ git:diff :
65+ desc : " `git diff` all translation files ignoring timestamp changes"
66+ cmds :
67+ # Ignore some PO metadata when git diff'ing, e.g.
68+ #
69+ # "POT-Creation-Date: 2025-03-12 18:18+0100\n"
70+ # "PO-Revision-Date: 2025-03-12 18:18+0100\n"
71+ - git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' '*.po'
72+
73+ git:restore :
74+ desc : ' `git restore` all translation file changes if only timestamps are changed (cf. `task {{.TASK | replace ":restore" ":diff" }}`)'
75+ cmds :
76+ - git restore '*.po'
77+ # https://taskfile.dev/reference/schema#precondition
78+ preconditions :
79+ - sh : task {{.TASK | replace ":restore" ":diff" }}
80+ msg : |
81+ Translations seem to have changed.
82+
83+ Run
84+
85+ task {{.TASK | replace ":restore" ":diff" }}
86+
87+ to check.
0 commit comments