Skip to content

Commit a491307

Browse files
committed
Merge branch 'jc/po-pritime-fix'
We started using "%" PRItime, imitating "%" PRIuMAX and friends, as a way to format the internal timestamp value, but this does not play well with gettext(1) i18n framework, and causes "make pot" that is run by the l10n coordinator to create a broken po/git.pot file. This is a possible workaround for that problem. * jc/po-pritime-fix: Makefile: help gettext tools to cope with our custom PRItime format
2 parents 981adb9 + fc0fd5b commit a491307

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,12 +2221,33 @@ LOCALIZED_SH += t/t0200/test.sh
22212221
LOCALIZED_PERL += t/t0200/test.perl
22222222
endif
22232223

2224+
## Note that this is meant to be run only by the localization coordinator
2225+
## under a very controlled condition, i.e. (1) it is to be run in a
2226+
## Git repository (not a tarball extract), (2) any local modifications
2227+
## will be lost.
2228+
## Gettext tools cannot work with our own custom PRItime type, so
2229+
## we replace PRItime with PRIuMAX. We need to update this to
2230+
## PRIdMAX if we switch to a signed type later.
2231+
22242232
po/git.pot: $(GENERATED_H) FORCE
2233+
# All modifications will be reverted at the end, so we do not
2234+
# want to have any local change.
2235+
git diff --quiet HEAD && git diff --quiet --cached
2236+
2237+
@for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2238+
do \
2239+
sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2240+
cat "$$s+" >"$$s" && rm "$$s+"; \
2241+
done
2242+
22252243
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
22262244
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
22272245
$(LOCALIZED_SH)
22282246
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
22292247
$(LOCALIZED_PERL)
2248+
2249+
# Reverting the munged source, leaving only the updated $@
2250+
git reset --hard
22302251
mv $@+ $@
22312252

22322253
.PHONY: pot

0 commit comments

Comments
 (0)