2018-04-03 23:39:17 +08:00
|
|
|
DOMAIN = $(PACKAGE_NAME)
|
|
|
|
COPYRIGHT_HOLDER = The Libvirt authors
|
|
|
|
MSGID_BUGS_ADDRESS = https://libvirt.org/bugs.html
|
|
|
|
|
|
|
|
LANGS := \
|
|
|
|
af am anp ar as ast bal be bg bn_IN \
|
|
|
|
bn bo br brx bs ca cs cy da de_CH \
|
2018-04-06 23:02:32 +08:00
|
|
|
de el en_GB eo es et eu fa fil fi \
|
2018-04-06 23:02:32 +08:00
|
|
|
fr fur ga gl gu he hi hr hu ia \
|
2018-04-03 23:39:17 +08:00
|
|
|
id ilo is it ja ka kk km kn ko \
|
|
|
|
kw_GB kw@kkcor kw kw@uccor ky lt lv mai mk ml \
|
2018-04-06 23:02:34 +08:00
|
|
|
mn mr ms my nb nds ne nl nn nso \
|
2018-04-03 23:39:17 +08:00
|
|
|
or pa pl pt_BR pt ro ru si sk sl \
|
|
|
|
sq sr@latin sr sv ta te tg th tr tw \
|
|
|
|
uk ur vi wba yo zh_CN zh_HK zh_TW zu
|
|
|
|
|
|
|
|
|
2019-11-08 22:25:33 +08:00
|
|
|
POTFILES_IN = $(srcdir)/POTFILES.in
|
|
|
|
POTFILES: $(POTFILES_IN)
|
|
|
|
$(AM_V_GEN) cat $(POTFILES_IN) | \
|
|
|
|
$(SED) 's|[@]SRCDIR[@]|$(top_srcdir)|' | \
|
|
|
|
$(SED) 's|[@]BUILDDIR[@]|$(top_builddir)|' > $@
|
|
|
|
POTFILE_DEPS = $(shell cat POTFILES)
|
2019-10-24 03:56:50 +08:00
|
|
|
POTFILE := $(DOMAIN).pot
|
|
|
|
POMINIFILES := $(LANGS:%=%.mini.po)
|
|
|
|
POFILES := $(LANGS:%=%.po)
|
|
|
|
GMOFILES := $(LANGS:%=%.gmo)
|
2018-04-03 23:39:17 +08:00
|
|
|
|
2019-11-08 22:25:33 +08:00
|
|
|
CLEANFILES = $(POTFILE) $(POFILES) $(GMOFILES) POTFILES
|
po: minimize & canonicalize translations stored in git
Similar to the libvirt.pot, .po files contain line numbers and file
names identifying where in the source a translatable string comes from.
The source locations in the .po files are thrown away and replaced with
content from the libvirt.pot whenever msgmerge is run, so this is not
precious information that needs to be stored in git.
When msgmerge processes a .po file, it will add in any msgids from the
libvirt.pot that were not already present. Thus, if a particular msgid
currently has no translation, it can be considered redundant and again
does not need storing in git.
When msgmerge processes a .po file and can't find an exact existing
translation match, it will try todo fuzzy matching instead, marking such
entries with a "# fuzzy" comment to alert the translator to take a
look and either discard, edit or accept the match. Looking at the
existing fuzzy matches in .po files shows that the quality is awful,
with many having a completely different set of printf format specifiers
between the msgid and fuzzy msgstr entry. Fortunately when msgfmt
generates the .gmo, the fuzzy entries are all ignored anyway. The fuzzy
entries could be useful to translators if they were working on the .po
files directly from git, but Libvirt outsourced translation to the
Fedora Zanata system, so keeping fuzzy matches in git is not much help.
Finally, by default msgids are sorted based on source location. Thus, if
a bit of code with translatable text is moved from one file to another,
it may shift around in the .po file, despite the msgid not itself changing.
If the msgids were sorted alphabetically, the .po files would have
stable ordering when code is refactored.
This patch takes advantage of the above observations to canonicalize
and minimize the content stored for .po files in git. Instead of storing
the real .po files, we now store .mini.po files.
The .mini.po files are the same file format as .po files, but have no
source location comments, are sorted alphabetically, and all fuzzy
msgstrs and msgids with no translation are discarded. This cuts the size
of content in the po directory from 109MB to 19MB.
Users working from a libvirt git checkout who need the full .po files
can run "make update-po", which merges the libvirt.pot and .mini.po
file to create a .po file containing all the content previously stored
in git.
Conversely if a full .po file has been modified, for example, by
downloading new content from Zanata, the .mini.po files can be updated
by running "make update-mini-po". The resulting diffs of the .mini.po
file will clearly show the changed translations without any of the noise
that previously obscured content. Being able to see content changes
clearly actually identified a bug in the zanata python client where it
was adding bogus "fuzzy" annotations to many messages:
https://bugzilla.redhat.com/show_bug.cgi?id=1564497
Users working from libvirt releases should not see any difference in
behaviour, since the tarballs only contain the full .po files, not the
.mini.po files.
As an added benefit, generating tarballs with "make dist", will no
longer cause creation of dirty files in git, since it won't touch the
.mini.po files, only the .po files which are no longer kept in git.
To avoid creating a single commit 100+MB in size, each language is
minimized separately in a following commit.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-05 02:45:40 +08:00
|
|
|
|
2018-04-03 23:39:17 +08:00
|
|
|
EXTRA_DIST = \
|
2019-11-08 22:25:33 +08:00
|
|
|
$(POTFILES_IN) \
|
2019-10-24 03:56:50 +08:00
|
|
|
$(POMINIFILES)
|
2018-04-03 23:39:17 +08:00
|
|
|
|
|
|
|
if HAVE_GNU_GETTEXT_TOOLS
|
|
|
|
|
|
|
|
XGETTEXT_ARGS = \
|
|
|
|
--default-domain=$(DOMAIN) \
|
|
|
|
--from-code=utf-8 \
|
|
|
|
--add-comments=TRANSLATORS: \
|
|
|
|
--keyword=_ --keyword=N_ \
|
|
|
|
--copyright-holder='$(COPYRIGHT_HOLDER)' \
|
|
|
|
--package-name="$(PACKAGE_NAME)" \
|
|
|
|
--package-version="$(PACKAGE_VERSION)" \
|
|
|
|
--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
|
|
|
|
$(NULL)
|
|
|
|
|
2020-01-06 22:23:06 +08:00
|
|
|
POT_CREATION_DATE = $(shell \
|
|
|
|
if test -n "$$SOURCE_DATE_EPOCH"; \
|
|
|
|
then \
|
|
|
|
date --date="@$$SOURCE_DATE_EPOCH" +"%F %R%z"; \
|
|
|
|
else \
|
|
|
|
date +'%F %R%z'; \
|
|
|
|
fi)
|
|
|
|
|
2018-04-03 23:39:17 +08:00
|
|
|
SED_PO_FIXUP_ARGS = \
|
2020-01-08 00:36:59 +08:00
|
|
|
-e "s|text/plain; charset=CHARSET|text/plain; charset=UTF-8|g" \
|
|
|
|
-e "s|SOME DESCRIPTIVE TITLE|Libvirt package strings|g" \
|
|
|
|
-e "s|Copyright (C) YEAR|Copyright (C) $$(date +'%Y')|" \
|
|
|
|
-e "s|POT-Creation-Date:[^\]*|POT-Creation-Date: $(POT_CREATION_DATE)|" \
|
|
|
|
$(NULL)
|
2018-04-03 23:39:17 +08:00
|
|
|
|
|
|
|
update-po: $(POFILES)
|
|
|
|
|
|
|
|
update-gmo: $(GMOFILES)
|
|
|
|
|
po: minimize & canonicalize translations stored in git
Similar to the libvirt.pot, .po files contain line numbers and file
names identifying where in the source a translatable string comes from.
The source locations in the .po files are thrown away and replaced with
content from the libvirt.pot whenever msgmerge is run, so this is not
precious information that needs to be stored in git.
When msgmerge processes a .po file, it will add in any msgids from the
libvirt.pot that were not already present. Thus, if a particular msgid
currently has no translation, it can be considered redundant and again
does not need storing in git.
When msgmerge processes a .po file and can't find an exact existing
translation match, it will try todo fuzzy matching instead, marking such
entries with a "# fuzzy" comment to alert the translator to take a
look and either discard, edit or accept the match. Looking at the
existing fuzzy matches in .po files shows that the quality is awful,
with many having a completely different set of printf format specifiers
between the msgid and fuzzy msgstr entry. Fortunately when msgfmt
generates the .gmo, the fuzzy entries are all ignored anyway. The fuzzy
entries could be useful to translators if they were working on the .po
files directly from git, but Libvirt outsourced translation to the
Fedora Zanata system, so keeping fuzzy matches in git is not much help.
Finally, by default msgids are sorted based on source location. Thus, if
a bit of code with translatable text is moved from one file to another,
it may shift around in the .po file, despite the msgid not itself changing.
If the msgids were sorted alphabetically, the .po files would have
stable ordering when code is refactored.
This patch takes advantage of the above observations to canonicalize
and minimize the content stored for .po files in git. Instead of storing
the real .po files, we now store .mini.po files.
The .mini.po files are the same file format as .po files, but have no
source location comments, are sorted alphabetically, and all fuzzy
msgstrs and msgids with no translation are discarded. This cuts the size
of content in the po directory from 109MB to 19MB.
Users working from a libvirt git checkout who need the full .po files
can run "make update-po", which merges the libvirt.pot and .mini.po
file to create a .po file containing all the content previously stored
in git.
Conversely if a full .po file has been modified, for example, by
downloading new content from Zanata, the .mini.po files can be updated
by running "make update-mini-po". The resulting diffs of the .mini.po
file will clearly show the changed translations without any of the noise
that previously obscured content. Being able to see content changes
clearly actually identified a bug in the zanata python client where it
was adding bogus "fuzzy" annotations to many messages:
https://bugzilla.redhat.com/show_bug.cgi?id=1564497
Users working from libvirt releases should not see any difference in
behaviour, since the tarballs only contain the full .po files, not the
.mini.po files.
As an added benefit, generating tarballs with "make dist", will no
longer cause creation of dirty files in git, since it won't touch the
.mini.po files, only the .po files which are no longer kept in git.
To avoid creating a single commit 100+MB in size, each language is
minimized separately in a following commit.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-05 02:45:40 +08:00
|
|
|
update-mini-po: $(POTFILE)
|
|
|
|
for lang in $(LANGS); do \
|
|
|
|
echo "Minimizing $$lang content" && \
|
|
|
|
$(MSGMERGE) --no-location --no-fuzzy-matching --sort-output \
|
|
|
|
$$lang.po $(POTFILE) | \
|
|
|
|
$(SED) $(SED_PO_FIXUP_ARGS) | \
|
2019-08-30 20:22:54 +08:00
|
|
|
$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/minimize-po.py > \
|
po: minimize & canonicalize translations stored in git
Similar to the libvirt.pot, .po files contain line numbers and file
names identifying where in the source a translatable string comes from.
The source locations in the .po files are thrown away and replaced with
content from the libvirt.pot whenever msgmerge is run, so this is not
precious information that needs to be stored in git.
When msgmerge processes a .po file, it will add in any msgids from the
libvirt.pot that were not already present. Thus, if a particular msgid
currently has no translation, it can be considered redundant and again
does not need storing in git.
When msgmerge processes a .po file and can't find an exact existing
translation match, it will try todo fuzzy matching instead, marking such
entries with a "# fuzzy" comment to alert the translator to take a
look and either discard, edit or accept the match. Looking at the
existing fuzzy matches in .po files shows that the quality is awful,
with many having a completely different set of printf format specifiers
between the msgid and fuzzy msgstr entry. Fortunately when msgfmt
generates the .gmo, the fuzzy entries are all ignored anyway. The fuzzy
entries could be useful to translators if they were working on the .po
files directly from git, but Libvirt outsourced translation to the
Fedora Zanata system, so keeping fuzzy matches in git is not much help.
Finally, by default msgids are sorted based on source location. Thus, if
a bit of code with translatable text is moved from one file to another,
it may shift around in the .po file, despite the msgid not itself changing.
If the msgids were sorted alphabetically, the .po files would have
stable ordering when code is refactored.
This patch takes advantage of the above observations to canonicalize
and minimize the content stored for .po files in git. Instead of storing
the real .po files, we now store .mini.po files.
The .mini.po files are the same file format as .po files, but have no
source location comments, are sorted alphabetically, and all fuzzy
msgstrs and msgids with no translation are discarded. This cuts the size
of content in the po directory from 109MB to 19MB.
Users working from a libvirt git checkout who need the full .po files
can run "make update-po", which merges the libvirt.pot and .mini.po
file to create a .po file containing all the content previously stored
in git.
Conversely if a full .po file has been modified, for example, by
downloading new content from Zanata, the .mini.po files can be updated
by running "make update-mini-po". The resulting diffs of the .mini.po
file will clearly show the changed translations without any of the noise
that previously obscured content. Being able to see content changes
clearly actually identified a bug in the zanata python client where it
was adding bogus "fuzzy" annotations to many messages:
https://bugzilla.redhat.com/show_bug.cgi?id=1564497
Users working from libvirt releases should not see any difference in
behaviour, since the tarballs only contain the full .po files, not the
.mini.po files.
As an added benefit, generating tarballs with "make dist", will no
longer cause creation of dirty files in git, since it won't touch the
.mini.po files, only the .po files which are no longer kept in git.
To avoid creating a single commit 100+MB in size, each language is
minimized separately in a following commit.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-05 02:45:40 +08:00
|
|
|
$(srcdir)/$$lang.mini.po ; \
|
|
|
|
done
|
|
|
|
|
2018-04-04 23:41:08 +08:00
|
|
|
push-pot: $(POTFILE)
|
2019-10-24 03:56:50 +08:00
|
|
|
zanata push \
|
|
|
|
--project-config $(srcdir)/zanata.xml \
|
|
|
|
--push-type=source \
|
|
|
|
--transdir $(builddir) \
|
|
|
|
--srcdir $(srcdir)
|
2018-04-04 23:41:08 +08:00
|
|
|
|
|
|
|
pull-po: $(POTFILE)
|
2019-10-24 03:56:50 +08:00
|
|
|
zanata pull \
|
|
|
|
--project-config $(srcdir)/zanata.xml \
|
|
|
|
--create-skeletons \
|
|
|
|
--transdir $(builddir) \
|
|
|
|
--srcdir $(srcdir)
|
po: minimize & canonicalize translations stored in git
Similar to the libvirt.pot, .po files contain line numbers and file
names identifying where in the source a translatable string comes from.
The source locations in the .po files are thrown away and replaced with
content from the libvirt.pot whenever msgmerge is run, so this is not
precious information that needs to be stored in git.
When msgmerge processes a .po file, it will add in any msgids from the
libvirt.pot that were not already present. Thus, if a particular msgid
currently has no translation, it can be considered redundant and again
does not need storing in git.
When msgmerge processes a .po file and can't find an exact existing
translation match, it will try todo fuzzy matching instead, marking such
entries with a "# fuzzy" comment to alert the translator to take a
look and either discard, edit or accept the match. Looking at the
existing fuzzy matches in .po files shows that the quality is awful,
with many having a completely different set of printf format specifiers
between the msgid and fuzzy msgstr entry. Fortunately when msgfmt
generates the .gmo, the fuzzy entries are all ignored anyway. The fuzzy
entries could be useful to translators if they were working on the .po
files directly from git, but Libvirt outsourced translation to the
Fedora Zanata system, so keeping fuzzy matches in git is not much help.
Finally, by default msgids are sorted based on source location. Thus, if
a bit of code with translatable text is moved from one file to another,
it may shift around in the .po file, despite the msgid not itself changing.
If the msgids were sorted alphabetically, the .po files would have
stable ordering when code is refactored.
This patch takes advantage of the above observations to canonicalize
and minimize the content stored for .po files in git. Instead of storing
the real .po files, we now store .mini.po files.
The .mini.po files are the same file format as .po files, but have no
source location comments, are sorted alphabetically, and all fuzzy
msgstrs and msgids with no translation are discarded. This cuts the size
of content in the po directory from 109MB to 19MB.
Users working from a libvirt git checkout who need the full .po files
can run "make update-po", which merges the libvirt.pot and .mini.po
file to create a .po file containing all the content previously stored
in git.
Conversely if a full .po file has been modified, for example, by
downloading new content from Zanata, the .mini.po files can be updated
by running "make update-mini-po". The resulting diffs of the .mini.po
file will clearly show the changed translations without any of the noise
that previously obscured content. Being able to see content changes
clearly actually identified a bug in the zanata python client where it
was adding bogus "fuzzy" annotations to many messages:
https://bugzilla.redhat.com/show_bug.cgi?id=1564497
Users working from libvirt releases should not see any difference in
behaviour, since the tarballs only contain the full .po files, not the
.mini.po files.
As an added benefit, generating tarballs with "make dist", will no
longer cause creation of dirty files in git, since it won't touch the
.mini.po files, only the .po files which are no longer kept in git.
To avoid creating a single commit 100+MB in size, each language is
minimized separately in a following commit.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-05 02:45:40 +08:00
|
|
|
$(MAKE) update-mini-po
|
2018-04-04 23:41:08 +08:00
|
|
|
$(MAKE) update-gmo
|
|
|
|
|
2018-04-03 23:39:17 +08:00
|
|
|
$(POTFILE): POTFILES $(POTFILE_DEPS)
|
2018-04-19 21:52:51 +08:00
|
|
|
$(XGETTEXT) -o $@-t $(XGETTEXT_ARGS) \
|
2019-11-08 22:25:33 +08:00
|
|
|
--files-from=$(abs_builddir)/POTFILES
|
2018-04-03 23:39:17 +08:00
|
|
|
$(SED) $(SED_PO_FIXUP_ARGS) < $@-t > $@
|
|
|
|
rm -f $@-t
|
|
|
|
|
2019-10-24 03:56:50 +08:00
|
|
|
%.po: %.mini.po $(POTFILE)
|
po: minimize & canonicalize translations stored in git
Similar to the libvirt.pot, .po files contain line numbers and file
names identifying where in the source a translatable string comes from.
The source locations in the .po files are thrown away and replaced with
content from the libvirt.pot whenever msgmerge is run, so this is not
precious information that needs to be stored in git.
When msgmerge processes a .po file, it will add in any msgids from the
libvirt.pot that were not already present. Thus, if a particular msgid
currently has no translation, it can be considered redundant and again
does not need storing in git.
When msgmerge processes a .po file and can't find an exact existing
translation match, it will try todo fuzzy matching instead, marking such
entries with a "# fuzzy" comment to alert the translator to take a
look and either discard, edit or accept the match. Looking at the
existing fuzzy matches in .po files shows that the quality is awful,
with many having a completely different set of printf format specifiers
between the msgid and fuzzy msgstr entry. Fortunately when msgfmt
generates the .gmo, the fuzzy entries are all ignored anyway. The fuzzy
entries could be useful to translators if they were working on the .po
files directly from git, but Libvirt outsourced translation to the
Fedora Zanata system, so keeping fuzzy matches in git is not much help.
Finally, by default msgids are sorted based on source location. Thus, if
a bit of code with translatable text is moved from one file to another,
it may shift around in the .po file, despite the msgid not itself changing.
If the msgids were sorted alphabetically, the .po files would have
stable ordering when code is refactored.
This patch takes advantage of the above observations to canonicalize
and minimize the content stored for .po files in git. Instead of storing
the real .po files, we now store .mini.po files.
The .mini.po files are the same file format as .po files, but have no
source location comments, are sorted alphabetically, and all fuzzy
msgstrs and msgids with no translation are discarded. This cuts the size
of content in the po directory from 109MB to 19MB.
Users working from a libvirt git checkout who need the full .po files
can run "make update-po", which merges the libvirt.pot and .mini.po
file to create a .po file containing all the content previously stored
in git.
Conversely if a full .po file has been modified, for example, by
downloading new content from Zanata, the .mini.po files can be updated
by running "make update-mini-po". The resulting diffs of the .mini.po
file will clearly show the changed translations without any of the noise
that previously obscured content. Being able to see content changes
clearly actually identified a bug in the zanata python client where it
was adding bogus "fuzzy" annotations to many messages:
https://bugzilla.redhat.com/show_bug.cgi?id=1564497
Users working from libvirt releases should not see any difference in
behaviour, since the tarballs only contain the full .po files, not the
.mini.po files.
As an added benefit, generating tarballs with "make dist", will no
longer cause creation of dirty files in git, since it won't touch the
.mini.po files, only the .po files which are no longer kept in git.
To avoid creating a single commit 100+MB in size, each language is
minimized separately in a following commit.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-05 02:45:40 +08:00
|
|
|
$(MSGMERGE) --no-fuzzy-matching $< $(POTFILE) | \
|
|
|
|
$(SED) $(SED_PO_FIXUP_ARGS) > $@
|
2018-04-03 23:39:17 +08:00
|
|
|
|
2019-10-24 03:56:50 +08:00
|
|
|
%.gmo: %.po
|
2018-04-19 21:52:51 +08:00
|
|
|
rm -f $@ $@-t
|
|
|
|
$(MSGFMT) -c -o $@-t $<
|
|
|
|
mv $@-t $@
|
2018-04-03 23:39:17 +08:00
|
|
|
|
|
|
|
.PRECIOUS: $(POTFILE) $(POFILES)
|
|
|
|
|
|
|
|
endif HAVE_GNU_GETTEXT_TOOLS
|
|
|
|
|
2018-04-25 16:53:09 +08:00
|
|
|
if ENABLE_NLS
|
|
|
|
|
2018-04-03 23:39:17 +08:00
|
|
|
# Cannot use 'localedir' since this conflicts with autoconf.
|
|
|
|
langinstdir = $(datadir)/locale
|
|
|
|
|
|
|
|
install-data-hook: $(GMOFILES)
|
|
|
|
mkdir -p $(DESTDIR)$(langinstdir)
|
|
|
|
for lang in $(LANGS); do \
|
|
|
|
d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \
|
|
|
|
mkdir -p $$d; \
|
2019-10-24 03:56:50 +08:00
|
|
|
install -m 0644 $$lang.gmo $$d/$(DOMAIN).mo; \
|
2018-04-03 23:39:17 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
uninstall-hook:
|
|
|
|
for lang in $(LANGS); do \
|
|
|
|
d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \
|
|
|
|
rm -f $$d/$(DOMAIN).mo; \
|
|
|
|
done
|
2018-04-25 16:53:09 +08:00
|
|
|
|
|
|
|
endif ENABLE_NLS
|