Added files with translations to several languages:
[hex-a-hop.git] / i18n / Makefile
blobe8a945a1d4a6ed66ffde2192e8f2dd9ba69ed303
1 # Copyright 2007 Miriam Ruiz <little_miry@yahoo.es>
2 # Copyright 2007 Jens Seidel <jensseidel@users.sf.net>
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17 # USA.
19 LOCALEDIR=./
21 all: hex-a-hop.pot build-stamp
23 # xgettext fails on _("Welcome to " GAMENAME "!") (doesn't extract anything
24 # behind the macro, so we preprocess hex_puzzzle.cpp first
25 hex_puzzzle_preprocessed.cpp: ../hex_puzzzle.cpp ../menus.h ../level_list.h
26 cd ..; $(CXX) $(CXXFLAGS) -E hex_puzzzle.cpp -o i18n/$@
28 hex-a-hop.pot: hex_puzzzle_preprocessed.cpp ../gfx.cpp ../man/hex-a-hop.6
29 @echo Creating Template \"$@\"
30 # Yes, we specify both hex_puzzzle.cpp AND i18n/hex_puzzzle_preprocessed.cpp
31 # as the preprocessed file does not contain all strings as preprocessor
32 # conditionals are already evaluated for the second file. We also want proper
33 # path references to source files (no .. prefix).
34 cd ..; xgettext --add-comments="TRANSLATORS:" -k_ -o "i18n/$@.templ" \
35 gfx.cpp hex_puzzzle.cpp menus.h level_list.h i18n/hex_puzzzle_preprocessed.cpp \
36 --msgid-bugs-address=hex-a-hop@packages.debian.org \
37 --copyright-holder="Tom Beaumont"
38 cd ..; po4a-updatepo -f man -m man/hex-a-hop.6 -p i18n/hex-a-hop.6.pot
39 @# lets now merge the POT files containing messages from source and manpage
40 sed 's/charset=CHARSET/charset=ascii/' hex-a-hop.pot.templ > hex-a-hop.pot.templ.po
41 sed 's/charset=CHARSET/charset=ascii/' hex-a-hop.6.pot > hex-a-hop.6.pot.po
42 @# The first sed commands prints only the header, the seconds inserts hex-a-hop.pot.comments
43 sed -n '1,/^$$/ p' hex-a-hop.pot.templ | sed "/^#$$/ r hex-a-hop.pot.comments" > hex-a-hop.pot
44 msgcat --width=79 hex-a-hop.pot.templ.po hex-a-hop.6.pot.po | sed -n '1,/^$$/ !p' >> hex-a-hop.pot
45 rm -f hex-a-hop.pot.templ hex-a-hop.6.pot hex-a-hop.pot.templ.po hex-a-hop.6.pot.po
47 build: build-stamp
48 build-stamp: hex-a-hop.pot
49 @# Merge all (old) PO files with POT file to ship up-to-date files!
50 @# (it cannot happen as usual in the clean target as there are not all patches
51 @# applied yet)
52 @set -e; cd ..; cat i18n/languages.list | while read lang enc; do \
53 echo Updating \"$$lang\" translation; \
54 msgmerge --width=79 --update i18n/$$lang.po i18n/hex-a-hop.pot; \
55 done
56 @set -e; cat languages.list | while read lang enc; do \
57 echo Building \"$$lang\" translation; \
58 msgfmt $$lang.po -o $$lang.mo; \
59 addendum=""; test -r ../man/hex-a-hop.$$lang.add && addendum="-a ../hex-a-hop.$$lang.add"; \
60 sed -n '/^msgid_plural / !p' $$lang.po | \
61 sed -n '/^msgstr\[[1-9]\] / !p' | \
62 sed 's/^msgstr\[0\] /msgstr /' > plural_forms_stripped.po; \
63 options=""; [ "$$enc" ] && options="-L $$enc"; \
64 po4a-translate $$options -f man -m ../man/hex-a-hop.6 -p plural_forms_stripped.po $$addendum -l ../hex-a-hop.$$lang.6; \
65 done
66 rm -f plural_forms_stripped.po # see bug #439842
67 touch build-stamp
69 clean:
70 rm -f *.mo
71 rm -f hex_puzzzle_preprocessed.cpp
72 rm -f build-stamp
73 @cat languages.list | while read lang enc; do \
74 rm -f ../hex-a-hop.$$lang.6; \
75 done
77 install: build-stamp
78 @cat languages.list | while read lang enc; do \
79 echo Installing \"$$lang\" translation; \
80 install -p -d -m 755 $(LOCALEDIR)$$lang/LC_MESSAGES ; \
81 install -m 644 $$lang.mo $(LOCALEDIR)$$lang/LC_MESSAGES/hex-a-hop.mo ; \
82 encdir=""; [ "$$enc" = utf-8 ] && encdir=.UTF-8; \
83 install -p -d -m 755 $(MANDIR)$$lang$$encdir/man6/ ; \
84 install -m 644 ../hex-a-hop.$$lang.6 $(MANDIR)$$lang$$encdir/man6/hex-a-hop.6 ; \
85 gzip -9 $(MANDIR)$$lang$$encdir/man6/hex-a-hop.6; \
86 done