Rev 189 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
38 | PointedEar | 1 | # Makefile for various po files. |
2 | |||
3 | srcdir = . |
||
189 | PointedEar | 4 | targetdir= ./LocaleData |
38 | PointedEar | 5 | |
6 | #CATALOGS = $(addsuffix .po, LINGUAS) |
||
7 | CATALOGS = $(LINGUAS) |
||
8 | MO_FILES = $(addsuffix .mo, $(LINGUAS)) |
||
9 | |||
10 | MSGMERGE = msgmerge |
||
11 | MSGFMT = msgfmt |
||
12 | XGETTEXT = xgettext |
||
13 | CATOBJEXT = .po |
||
14 | |||
15 | include PACKAGE |
||
16 | |||
17 | TD = $(strip $(TEXTDOMAIN)) |
||
18 | |||
19 | default: help |
||
20 | |||
21 | all: $(TD).pot update-po update-mo install |
||
22 | |||
23 | help: |
||
24 | @echo "Available targets:" |
||
25 | @echo " pot - remake master catalog" |
||
26 | @echo " update-po - merge po files" |
||
27 | @echo " update-mo - regenerate mo files" |
||
28 | @echo " install - install mo files" |
||
29 | @echo " all - all of the above" |
||
30 | |||
31 | POTFILES = $(srcdir)/POTFILES.in \ |
||
32 | $(shell cat $(srcdir)/POTFILES.in) |
||
33 | |||
34 | pot: $(TD).pot |
||
35 | |||
36 | clean: |
||
37 | rm -f *~ *.bak *.mo |
||
38 | |||
39 | # FIXME: The parameter --from-code is only needed if your sources contain |
||
40 | # any 8 bit data (even in comments). UTF-8 is only a guess here, but it |
||
41 | # will at least accept any 8 bit data. |
||
42 | # |
||
43 | # The parameter "--language=perl" is not strictly needed because the |
||
44 | # source language of all our files will be auto-detected by xgettext |
||
45 | # by their filename extension. You should even avoid this parameter |
||
46 | # if you want to extract strings from multiple source languages. |
||
56 | PointedEar | 47 | # --keyword --keyword='_' --keyword='$$__' --keyword=__ --keyword=__x \ |
48 | # --keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \ |
||
49 | # --keyword=__p:1c,2 --keyword=__np:1c,2,3 \ |
||
50 | # --keyword=__npx:1c,2,3 --keyword=N__ --keyword=N__n:1,2 \ |
||
51 | # --keyword=N__p:1c,2 --keyword=N__np:1c,2,3 --keyword=%__ \ |
||
38 | PointedEar | 52 | $(TD).pot: $(POTFILES) |
53 | $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \ |
||
54 | --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \ |
||
56 | PointedEar | 55 | --package-name="$(PACKAGE_NAME)" \ |
56 | --package-version="$(PACKAGE_VERSION)" \ |
||
38 | PointedEar | 57 | --copyright-holder="$(COPYRIGHT_HOLDER)" \ |
58 | --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \ |
||
59 | rm -f $@ && mv $(TD).pox $@ |
||
60 | |||
61 | install: $(MO_FILES) |
||
62 | cd $(srcdir); \ |
||
189 | PointedEar | 63 | targetdir='$(targetdir)'; \ |
38 | PointedEar | 64 | languages='$(LINGUAS)'; \ |
65 | for lang in $$languages; do \ |
||
66 | mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \ |
||
67 | dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \ |
||
68 | cat="$$lang.mo"; \ |
||
69 | echo "installing $$cat as $$dest"; \ |
||
70 | cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \ |
||
71 | done |
||
72 | |||
73 | update-mo: $(MO_FILES) |
||
74 | |||
75 | update-po: |
||
76 | $(MAKE) $(TD).pot |
||
77 | cd $(srcdir); \ |
||
78 | catalogs='$(CATALOGS)'; \ |
||
79 | for cat in $$catalogs; do \ |
||
80 | cat=`basename $$cat`; \ |
||
81 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ |
||
82 | mv $$lang.po $$lang.old.po; \ |
||
83 | echo "$$lang:"; \ |
||
84 | if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \ |
||
85 | rm -f $$lang.old.po; \ |
||
86 | else \ |
||
87 | echo "msgmerge for $$cat failed!"; \ |
||
88 | rm -f $$lang.po; \ |
||
89 | mv $$lang.old.po $$lang.po; \ |
||
90 | fi; \ |
||
91 | done |
||
92 | |||
93 | .SUFFIXES: |
||
94 | .SUFFIXES: .po .mo |
||
95 | |||
96 | .po.mo: |
||
97 | $(MSGFMT) --check --statistics --verbose -o $@ $< |
||
98 |