[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add change detection to make i18n for easier commit #14118

Merged
merged 5 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,25 @@ update-po:
set -eu; \
for lang in $(LINGUAS); do\
msgmerge --backup=none -U $$lang.po po/$(DOMAIN).pot; \
done
done; \
if [ -t 0 ] && ! git diff --quiet -- po/*.po; then \
read -rp "Would you like to commit i18n changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -sm "i18n: Update translations." -- po/*.po; fi; \
fi

.PHONY: update-pot
update-pot:
ifeq "$(LXD_OFFLINE)" ""
(cd / ; go install github.com/snapcore/snapd/i18n/xgettext-go@2.57.1)
endif
xgettext-go -o po/$(DOMAIN).pot --add-comments-tag=TRANSLATORS: --sort-output --package-name=$(DOMAIN) --msgid-bugs-address=lxd@lists.canonical.com --keyword=i18n.G --keyword-plural=i18n.NG lxc/*.go lxc/*/*.go
if git diff --quiet --ignore-matching-lines='^\s*"POT-Creation-Date: .*\n"' -- po/*.pot; then git checkout -- po/*.pot; fi
if [ -t 0 ] && ! git diff --quiet --ignore-matching-lines='^\s*"POT-Creation-Date: .*\n"' -- po/*.pot; then \
read -rp "Would you like to commit i18n template changes (Y/n)? " answer; \
if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \
git commit -sm "i18n: Update translation templates." -- po/*.pot; fi; \
fi

.PHONY: build-mo
build-mo: $(MOFILES)
Expand Down
Loading
Loading