Android release v6.7_preview1
[xcsoar.git] / build / gettext.mk
blob874e5fe6748289746504f38a43b6e68ae99412e9
1 # Generate .po and .mo files. For the gettext library (aka libintl),
2 # see libintl.mk.
4 XGETTEXT = xgettext
5 MSGCAT = msgcat
6 MSGFMT = msgfmt
7 MSGMERGE = msgmerge
9 GETTEXT_PACKAGE = xcsoar
10 GETTEXT_SOURCES = $(XCSOAR_SOURCES) \
11 $(wildcard $(SRC)/Dialogs/Vega/*Parameters.hpp) \
12 $(SRC)/Terrain/RasterWeather.cpp
13 GETTEXT_DIALOGS = $(wildcard Data/Dialogs/*.xml)
14 GETTEXT_DIALOGS += $(wildcard Data/Dialogs/Configuration/*.xml)
15 GETTEXT_EVENTS = Data/Input/default.xci
16 PO_FILES = $(wildcard po/*.po)
17 MO_FILES = $(patsubst po/%.po,$(OUT)/po/%.mo,$(PO_FILES))
18 LINGUAS = $(patsubst po/%.po,%,$(PO_FILES))
20 $(OUT)/po/cpp.pot: $(GETTEXT_SOURCES) | $(OUT)/po/dirstamp
21 @$(NQ)echo " GEN $@"
22 $(Q)$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \
23 --add-comments --keyword=_ --keyword=N_ \
24 --from-code=utf-8 \
25 --keyword=C_:1c,2 \
26 --keyword=NC_:1c,2 \
27 --flag=N_:1:no-c-format \
28 --flag=C_:2:no-c-format \
29 --flag=NC_:2:no-c-format \
30 --output=$@ \
31 --force-po \
34 $(OUT)/po/xml.pot: $(GETTEXT_DIALOGS) | $(OUT)/po/dirstamp
35 @$(NQ)echo " GEN $@"
36 $(Q)$(PERL) $(topdir)/tools/xml2po.pl $^ >$@.tmp
37 $(Q)mv $@.tmp $@
39 $(OUT)/po/event.pot: $(GETTEXT_EVENTS) | $(OUT)/po/dirstamp
40 @$(NQ)echo " GEN $@"
41 $(Q)$(PERL) $(topdir)/tools/xci2po.pl $^ >$@.tmp
42 $(Q)mv $@.tmp $@
44 po/$(GETTEXT_PACKAGE).pot: $(OUT)/po/cpp.pot $(OUT)/po/xml.pot $(OUT)/po/event.pot
45 @$(NQ)echo " GEN $@"
46 $(Q)$(MSGCAT) -o $@ $^
48 mo: $(MO_FILES)
50 update-po: po/$(GETTEXT_PACKAGE).pot
51 $(Q)for i in $(PO_FILES); do $(MSGMERGE) -o $$i $$i po/$(GETTEXT_PACKAGE).pot; done
53 $(MO_FILES): $(OUT)/po/%.mo: po/%.po | $(OUT)/po/dirstamp
54 @$(NQ)echo " GEN $@"
55 $(Q)$(MSGFMT) --check -o $@ $<