summaryrefslogtreecommitdiff
path: root/i18n/Makefile.am
blob: b6a224da1994a8fe4d4205adfc95b0694dc31b50 (plain)
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
# Makefile for PO directories.
# Fran�ois Pinard <pinard@iro.umontreal.ca>, 1998.

AUTOMAKE_OPTIONS = gnits

localedir = $(prefix)/share/locale

ALL_POFILES = @ALL_POFILES@
ALL_MOFILES = @ALL_MOFILES@
MOFILES = @MOFILES@

EXTRA_DIST = $(PACKAGE).pot $(ALL_POFILES) $(ALL_MOFILES)

MSGFMT = msgfmt
MSGMERGE = msgmerge
XGETTEXT = xgettext

SUFFIXES = .po .pox .mo

.po.pox:
	$(MAKE) $(PACKAGE).pot
	$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox

.po.mo:
	file=$(srcdir)/`echo $* | sed 's,.*/,,'`.mo \
	  && rm -f $$file && $(MSGFMT) -o $$file $<

all: $(ALL_MOFILES)

install-data-local: $(MOFILES)
if USE_NLS
	files='$(MOFILES)'; \
	for file in $$files; do \
	  base=`basename $$file`; \
	  langdir=$(localedir)/`echo $$base | sed 's/\.mo$$//'`/LC_MESSAGES; \
	  $(mkinstalldirs) $$langdir; \
	  echo " $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$$langdir/$(PACKAGE).mo"; \
	  $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$$langdir/$(PACKAGE).mo; \
	done
endif

uninstall-local:
if USE_NLS
	files='$(MOFILES)'; \
	for file in $$files; do \
	  base=`basename $$file`; \
	  langdir=$(localedir)/`echo $$base | sed 's/\.mo$$//'`/LC_MESSAGES; \
	  rm -f $(DESTDIR)$$langdir/$(PACKAGE).mo; \
	done
endif

MAINTAINER_CLEAN = $(PACKAGE).pot $(MOFILES)

$(srcdir)/$(PACKAGE).pot: $(top_srcdir)/stamp-pot
	$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
	  --add-comments --keyword=_ --keyword=N_ `cat $(top_srcdir)/stamp-pot`
	test ! -f $(PACKAGE).po || ( rm -f $@ && mv $(PACKAGE).po $@ )

update-po: Makefile
	$(MAKE) $(PACKAGE).pot
	files='$(ALL_MOFILES)'; \
	for file in $$files; do \
	  base=`basename $$file`; \
	  lang=`echo $$base | sed 's/\.mo$$//'`; \
	  mv $(srcdir)/$$lang.po $(srcdir)/$$lang.old.po; \
	  echo "$$lang:"; \
	  cd $(srcdir) \
	    && if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
	      rm -f $$lang.old.po; \
	    else \
	      echo "msgmerge for $$file failed!"; \
	      rm -f $$lang.po; \
	      mv $$lang.old.po $$lang.po; \
	    fi; \
	done