From 4421e8a8252faef5cb984bd1b25ee5ede48ac19c Mon Sep 17 00:00:00 2001 From: Markus Neteler Date: Wed, 29 May 2024 23:16:25 +0200 Subject: [PATCH] i18n: add deduplication to make update-po (#3735) Add gettext message deduplication to `make update-po` step. Fixes #3465 --- locale/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/locale/Makefile b/locale/Makefile index 18d0e6b9599..4891840f141 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -57,7 +57,7 @@ pot: @echo "Generating $(WXPYDOMAIN)..." xgettext --keyword=_ --keyword=n_:1,2 -cGTC -o ./templates/$(WXPYDOMAIN).pot `$(WXPY_POTFILES)` -#merge already existing translations with new messages in POT template file and create new po files: +#merge already existing translations with new messages in POT template file, deduplicate it and create new po files: update-po: @for i in $(DOMAINS) ; do \ if [ "`ls ./po/$$i\_*.po 2>/dev/null`" = "" ] ; then \ @@ -72,7 +72,8 @@ update-po: lingua=`basename $$suffix .po`; \ prefix=`echo $$po | cut -d'_' -f1`; \ if msgmerge -o $$prefix\_$$suffix.new $$prefix\_$$suffix ../templates/$$prefix.pot; then\ - mv $$prefix\_$$suffix.new $$prefix\_$$suffix; \ + msguniq --use-first $$prefix\_$$suffix.new > $$prefix\_$$suffix; \ + rm -f $$prefix\_$$suffix.new; \ echo "Merged new messages into $$prefix\_$$suffix" ; \ else \ echo "Merging failed"; \