-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.po.inc
82 lines (72 loc) · 2.5 KB
/
Makefile.po.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Makefile.po.inc for frugalwareutils
#
# Copyright (C) 2006, 2007, 2008, 2009 Miklos Vajna <vmiklos@frugalware.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
LANG_CHARSETS = da_DK,ISO-8859-1 fr_FR,ISO-8859-1 hu_HU,ISO-8859-2
compile:
for i in $(wildcard *.po); do \
echo -n "$$i: "; \
msgfmt -c --statistics -o $$i.mo $$i || exit 1; \
done
install:
for i in $(wildcard *.po); do \
mkdir -p $(DESTDIR)$(localedir)/`basename $$i .po`/LC_MESSAGES/; \
$(INSTALL) -m644 $$i.mo $(DESTDIR)$(localedir)/`basename $$i .po`/LC_MESSAGES/$(DOMAIN).mo; \
done
intltool-extract:
@if [ -e /usr/bin/intltool-extract ]; then \
cp /usr/bin/intltool-extract ./; \
else \
echo 2>&1 "Install intltool first."; \
exit 1; \
fi
pot: intltool-extract
intltool-update --pot --gettext-package=$(DOMAIN)
update-po: pot
for lang in $(wildcard *.po); do \
if msgmerge $$lang.po $(DOMAIN).pot -o $$lang.new.po; then \
mv -f $$lang.new.po $$lang.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.new.po; \
fi; \
done
%.po: $(DOMAIN).pot
msginit -l $(basename $@)_$(shell echo $(basename $@)|tr [a-z] [A-Z])
clean:
rm -f $(DOMAIN).pot *.mo *.po intltool-extract
prepare:
@if [ -d $(PO_DIR) ]; then \
for i in $(LANGS); \
do \
if [ -e $(PO_DIR)/frugalwareutils/$$i/$(DOMAIN).po ]; then \
cp $(PO_DIR)/frugalwareutils/$$i/$(DOMAIN).po $$i.po; \
charset=$$(echo $(LANG_CHARSETS)|sed 's/ /\n/g'|grep ^$$i|sed 's/.*,//'); \
if [ -n "$$charset" -a "$(DOMAIN)" != "mans" ]; then \
iconv -f UTF-8 -t $$charset < $$i.po > $$i.new.po; \
sed "s/UTF-8/$$charset/" $$i.new.po > $$i.po; \
rm $$i.new.po; \
fi; \
if ! msgfmt -c --statistics -o $$i.gmo $$i.po; then \
echo "ERROR: $(DOMAIN)/$$i.po would break your build!"; \
exit 1; \
fi; \
fi; \
done; \
else \
echo "WARNING: $(PO_DIR) does not exist, skipping translations for $(DOMAIN)."; \
fi
# vim: ft=make