Skip to content

Commit

Permalink
i18n: add deduplication to make update-po (#3735)
Browse files Browse the repository at this point in the history
Add gettext message deduplication to `make update-po` step.

Fixes #3465
  • Loading branch information
neteler committed May 31, 2024
1 parent a981501 commit 4421e8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions locale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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"; \
Expand Down

0 comments on commit 4421e8a

Please sign in to comment.