| 1 |
# The full list of various input and output file types |
| 2 |
PO_INPUTS = $(wildcard $(srcdir)/po/*.po) |
| 3 |
|
| 4 |
# Extract translate attribute, Glade style, angular-gettext HTML translations |
| 5 |
po/cockpit.html.pot: $(srcdir)/package-lock.json |
| 6 |
$(AM_V_GEN) mkdir -p $(dir $@) && \ |
| 7 |
$(srcdir)/pkg/lib/html2po -d $(srcdir) -o $@ \ |
| 8 |
$$(cd $(srcdir) && find pkg/ -name '*.html') |
| 9 |
|
| 10 |
# Extract cockpit style javascript translations |
| 11 |
# Recommended to have appstream installed as it includes the newest metadata its files |
| 12 |
po/cockpit.js.pot: |
| 13 |
$(AM_V_GEN) mkdir -p $(dir $@) && \ |
| 14 |
xgettext --default-domain=cockpit --output=- --language=C --keyword= \ |
| 15 |
--keyword=_:1,1t --keyword=_:1c,2,2t --keyword=C_:1c,2 \ |
| 16 |
--keyword=N_ --keyword=NC_:1c,2 \ |
| 17 |
--keyword=gettext:1,1t --keyword=gettext:1c,2,2t \ |
| 18 |
--keyword=ngettext:1,2,3t --keyword=ngettext:1c,2,3,4t \ |
| 19 |
--keyword=gettextCatalog.getString:1,3c --keyword=gettextCatalog.getPlural:2,3,4c \ |
| 20 |
--from-code=UTF-8 --directory=$(srcdir) \ |
| 21 |
$$( cd $(srcdir) && find pkg/ ! -name 'test-*' -name '*.[jt]s' -o -name '*.[jt]sx') | \ |
| 22 |
sed '/^#/ s/, c-format//' > $@ && \ |
| 23 |
sed -i 's/charset=CHARSET/charset=UTF-8/g' $@ |
| 24 |
|
| 25 |
po/cockpit.manifest.pot: |
| 26 |
$(AM_V_GEN) mkdir -p $(dir $@) && \ |
| 27 |
$(srcdir)/pkg/lib/manifest2po -d $(srcdir) -o $@ \ |
| 28 |
$$(cd $(srcdir) && find pkg/ -name 'manifest.json') |
| 29 |
|
| 30 |
po/cockpit.appstream.pot: |
| 31 |
$(AM_V_GEN) mkdir -p $(dir $@) && \ |
| 32 |
GETTEXTDATADIRS=$(srcdir)/po xgettext --output=$@ --directory=$(srcdir) \ |
| 33 |
$$(cd $(srcdir) && find pkg/ src/ -name '*.appdata.xml.in' -o -name '*.metainfo.xml.in') && \ |
| 34 |
sed -i 's/charset=CHARSET/charset=UTF-8/g' $@ |
| 35 |
|
| 36 |
po/cockpit.polkit.pot: |
| 37 |
$(AM_V_GEN) mkdir -p $(dir $@) && \ |
| 38 |
GETTEXTDATADIRS=$(srcdir)/po xgettext --output=$@ --directory=$(srcdir) \ |
| 39 |
$$(cd $(srcdir) && find src/ -name '*.policy.in') && \ |
| 40 |
sed -i 's/charset=CHARSET/charset=UTF-8/g' $@ |
| 41 |
|
| 42 |
# Combine the above pot files into one |
| 43 |
po/cockpit.pot: po/cockpit.html.pot po/cockpit.js.pot po/cockpit.manifest.pot po/cockpit.appstream.pot po/cockpit.polkit.pot |
| 44 |
$(AM_V_GEN) mkdir -p $(dir $@) && \ |
| 45 |
xgettext --output=$@ $^ |
| 46 |
|
| 47 |
CLEANFILES += \ |
| 48 |
dist/shell/*.po \ |
| 49 |
src/ws/*.po \ |
| 50 |
po/cockpit*.pot \ |
| 51 |
$(NULL) |
| 52 |
|
| 53 |
EXTRA_DIST += \ |
| 54 |
$(PO_INPUTS) \ |
| 55 |
po/its/polkit.its \ |
| 56 |
po/its/polkit.loc \ |
| 57 |
$(NULL) |