1 xmldir = $(datadir)/xml/iso-codes
2 nodist_xml_DATA = $(DOMAIN).xml
4 pofiles = $(wildcard $(srcdir)/*.po)
5 mofiles = $(patsubst $(srcdir)/%.po,%.mo, $(pofiles))
6 noinst_DATA = $(mofiles) $(xml_DATA:.xml=.pot)
8 localedir = $(datadir)/locale
18 # Generic target to create binary .mo files from .po files
20 $(MSGFMT) $(MSGFMT_FLAGS) -o $@ $<
22 # Generic target to create .pot files from JSON data files
23 $(DOMAIN).pot: $(top_srcdir)/bin/pot_from_json.py $(top_srcdir)/data/$(DOMAIN).json $(top_srcdir)/bin/remove-potcdate.sin
25 python3 $(top_srcdir)/bin/pot_from_json.py $(DOMAIN) $(top_srcdir)/data
26 sed -f $(top_srcdir)/bin/remove-potcdate.sin < $@ > $(DOMAIN).1po
27 sed -f $(top_srcdir)/bin/remove-potcdate.sin < backup.pot > $(DOMAIN).2po
28 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
29 rm -f $(DOMAIN).1po $(DOMAIN).2po $@ && \
32 rm -f $(DOMAIN).1po $(DOMAIN).2po backup.pot; \
35 # Generic target to create deprecated .xml files from JSON data files
36 $(DOMAIN).xml: $(top_srcdir)/bin/xml_from_json.py $(top_srcdir)/data/$(DOMAIN).json
37 python3 $(top_srcdir)/bin/xml_from_json.py $(DOMAIN) $(top_srcdir)/data $@
39 # Used in the domain subdirectories for checking that
40 # all .po files contain UTF-8 data
42 python3 $(top_srcdir)/bin/check_valid_utf8.py $(pofiles)
44 # This target merges all po files with the current pot file,
45 # removes obsolete msgids and substitutes the Project-Id-Version
46 # header with the PROJECT only, removing the VERSION part.
47 # This is done to keep the diff between releases small.
50 # Removing obsolete msgids is not the recommended way to go.
51 # However, we've decided that in the specific case of iso-codes
52 # the benefit outweights the loss of information. Having only msgids
53 # with one (sometimes two or three) words, the fuzzy matching performed
54 # with obsolete msgids will not ease the translator's work, but
55 # will lead to confusing entries.
57 # However, if there is only a small change, we include the fuzzy
58 # entry with the previous msgid to hopefully save some work.
61 for pofile in $(pofiles); do \
62 $(MSGMERGE) --previous $$pofile $(DOMAIN).pot > tmpfile; \
63 $(MSGATTRIB) --no-obsolete tmpfile > $$pofile; \
64 sed -i -e 's/^\"Project-Id-Version: iso.*/\"Project-Id-Version: $(DOMAIN)\\n\"/' $$pofile; \
67 if [ -f sr.po ]; then \
68 $(RECODE_SR_LATIN) < sr.po > sr@latin.po; \
69 sed -i -e 's/^\"Language: sr\\n\"/\"Language: sr@latin\\n\"/' sr@latin.po; \
71 if [ -f tt@iqtelif.po ]; then \
72 $(MSGFILTER) --keep-header sed -f $(top_srcdir)/bin/recode-tt-cyrillic.sed < tt@iqtelif.po > tt.po; \
73 sed -i -e 's/^\"Language: tt@iqtelif\\n\"/\"Language: tt\\n\"/' tt.po; \
76 install-data-hook: $(mofiles)
77 $(mkinstalldirs) $(DESTDIR)$(localedir)
78 catalogs='$(mofiles)'; \
79 for cat in $$catalogs; do \
80 cat=`basename $$cat`; \
81 lang=`echo $$cat | sed 's/\.mo$$//'`; \
82 dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
83 $(mkinstalldirs) $$dir; \
84 $(INSTALL_DATA) $$cat $$dir/$(DOMAIN).mo; \
85 if [ "$(DOMAIN)" = "iso_639-2" ]; then (cd $$dir && $(LN_S) $(DOMAIN).mo iso_639.mo); fi; \
86 if [ "$(DOMAIN)" = "iso_639-3" ]; then (cd $$dir && $(LN_S) $(DOMAIN).mo iso_639_3.mo); fi; \
87 if [ "$(DOMAIN)" = "iso_639-5" ]; then (cd $$dir && $(LN_S) $(DOMAIN).mo iso_639_5.mo); fi; \
88 if [ "$(DOMAIN)" = "iso_3166-1" ]; then (cd $$dir && $(LN_S) $(DOMAIN).mo iso_3166.mo); fi; \
89 if [ "$(DOMAIN)" = "iso_3166-2" ]; then (cd $$dir && $(LN_S) $(DOMAIN).mo iso_3166_2.mo); fi; \
91 if [ "$(DOMAIN)" = "iso_639-2" ]; then (cd $(DESTDIR)$(xmldir) && $(LN_S) $(DOMAIN).xml iso_639.xml); fi
92 if [ "$(DOMAIN)" = "iso_639-3" ]; then (cd $(DESTDIR)$(xmldir) && $(LN_S) $(DOMAIN).xml iso_639_3.xml); fi
93 if [ "$(DOMAIN)" = "iso_639-5" ]; then (cd $(DESTDIR)$(xmldir) && $(LN_S) $(DOMAIN).xml iso_639_5.xml); fi
94 if [ "$(DOMAIN)" = "iso_3166-1" ]; then (cd $(DESTDIR)$(xmldir) && $(LN_S) $(DOMAIN).xml iso_3166.xml); fi
95 if [ "$(DOMAIN)" = "iso_3166-2" ]; then (cd $(DESTDIR)$(xmldir) && $(LN_S) $(DOMAIN).xml iso_3166_2.xml); fi
98 catalogs='$(mofiles)'; \
99 for cat in $$catalogs; do \
100 cat=`basename $$cat`; \
101 lang=`echo $$cat | sed 's/\.mo$$//'`; \
102 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
103 if [ "$(DOMAIN)" = "iso_639-2" ]; then rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/iso_639.mo; fi; \
104 if [ "$(DOMAIN)" = "iso_639-3" ]; then rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/iso_639_3.mo; fi; \
105 if [ "$(DOMAIN)" = "iso_639-5" ]; then rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/iso_639_5.mo; fi; \
106 if [ "$(DOMAIN)" = "iso_3166-1" ]; then rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/iso_3166.mo; fi; \
107 if [ "$(DOMAIN)" = "iso_3166-1" ]; then rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/iso_3166_2.mo; fi; \
109 if [ "$(DOMAIN)" = "iso_639-2" ]; then rm -f $(DESTDIR)$(xmldir)/iso_639.xml; fi
110 if [ "$(DOMAIN)" = "iso_639-3" ]; then rm -f $(DESTDIR)$(xmldir)/iso_639_3.xml; fi
111 if [ "$(DOMAIN)" = "iso_639-5" ]; then rm -f $(DESTDIR)$(xmldir)/iso_639_5.xml; fi
112 if [ "$(DOMAIN)" = "iso_3166-1" ]; then rm -f $(DESTDIR)$(xmldir)/iso_3166.xml; fi
113 if [ "$(DOMAIN)" = "iso_3166-2" ]; then rm -f $(DESTDIR)$(xmldir)/iso_3166_2.xml; fi