Skip to content

Commit 0efb2d1

Browse files
committed
Cleaned up translations
1 parent 62fead8 commit 0efb2d1

File tree

21 files changed

+5982
-6929
lines changed

21 files changed

+5982
-6929
lines changed

config/translations/config.da.po

Lines changed: 4185 additions & 4695 deletions
Large diffs are not rendered by default.

task/Taskfile.translation.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,6 @@ tasks:
231231
- task: theme-translations:import
232232
silent: true
233233

234-
clean-up-translations:
235-
internal: true
236-
cmds:
237-
# Fix plurals spec in Danish PO file
238-
# https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
239-
# https://www.drupal.org/project/drupal/issues/3496223
240-
- |
241-
docker run --user=${COMPOSE_USER:-deploy} --rm --volume "$PWD:/app" itkdev/php8.3-fpm sed --in-place 's/Plural-Forms: nplurals=2; plural=(n > 1);/Plural-Forms: nplurals=2; plural=(n != 1);/' $(find translations config/translations web/*/custom/*/translations -name '*.da.po')
242-
243234
# ------------------------------------------------------------------------------
244235
# Internal helper tasks.
245236
# ------------------------------------------------------------------------------
@@ -291,3 +282,30 @@ tasks:
291282
- TYPE
292283
- NAMES
293284
silent: true
285+
286+
clean-up-translations:
287+
internal: true
288+
cmds:
289+
- echo {{.TMP_NAME}}
290+
# Fix plurals spec in Danish PO files
291+
# https://drupalsun.com/eelke/2020/08/17/tale-mistranslated-plurals
292+
# https://www.drupal.org/project/drupal/issues/3496223
293+
- |
294+
{{.SHELL}} sed --in-place 's/Plural-Forms: nplurals=2; plural=(n > 1);/Plural-Forms: nplurals=2; plural=(n != 1);/' $(find translations config/translations web/*/custom/*/translations -name '*.da.po')
295+
# Set 'Language' field in the header entry in Danish PO files
296+
- |
297+
for f in $(find translations config/translations web/*/custom/*/translations -name '*.da.po'); do
298+
{{.SHELL}} msgcat --lang=da "$f" > {{.TMP_FILE_PATH}} && mv {{.TMP_FILE_PATH}} "$f"
299+
done
300+
# Replace \r\n with \n PO files
301+
- |
302+
{{.SHELL}} sed --in-place 's/\\r\\n/\\n/g' $(find translations config/translations web/*/custom/*/translations -name '*.po')
303+
# Make translations unique and sort them
304+
# (cf. https://www.man7.org/linux/man-pages/man1/msguniq.1.html)
305+
- |
306+
for f in $(find translations config/translations web/*/custom/*/translations -name '*.po'); do
307+
{{.SHELL}} msguniq --unique --sort-output --no-wrap "$f" > {{.TMP_FILE_PATH}} && mv {{.TMP_FILE_PATH}} "$f"
308+
done
309+
vars:
310+
SHELL: docker run --user=${COMPOSE_USER:-deploy} --rm --volume "$PWD:/app" itkdev/php8.4-fpm
311+
TMP_FILE_PATH: /tmp/translations.tmp

0 commit comments

Comments
 (0)