Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-java / po / Makefile.am
blobc651bc79e7236706328441ee6419f420846c483e
1 # Example for use of GNU gettext.
2 # This file is in the public domain.
4 # Makefile configuration - processed by automake.
6 # List of files which contain translatable strings.
7 POTFILES = \
8   Hello.java
10 # Usually the message domain is the same as the package name.
11 DOMAIN = $(PACKAGE)
13 # These options get passed to xgettext.
14 XGETTEXT_OPTIONS =
16 # This is the copyright holder that gets inserted into the header of the
17 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
18 # package.  (Note that the msgstr strings, extracted from the package's
19 # sources, belong to the copyright holder of the package.)  Translators are
20 # expected to transfer the copyright for their translations to this person
21 # or entity, or to disclaim their copyright.  The empty string stands for
22 # the public domain; in this case the translators are expected to disclaim
23 # their copyright.
24 COPYRIGHT_HOLDER = Yoyodyne, Inc.
26 # This is the email address or URL to which the translators shall report
27 # bugs in the untranslated strings:
28 # - Strings which are not entire sentences, see the maintainer guidelines
29 #   in the GNU gettext documentation, section 'Preparing Strings'.
30 # - Strings which use unclear terms or require additional context to be
31 #   understood.
32 # - Strings which make invalid assumptions about notation of date, time or
33 #   money.
34 # - Pluralisation problems.
35 # - Incorrect English spelling.
36 # - Incorrect formatting.
37 # It can be your email address, or a mailing list address where translators
38 # can write to without being subscribed, or the URL of a web page through
39 # which the translators can contact you.
40 MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
42 # These options get passed to msgmerge.
43 # Useful options are in particular:
44 #   --previous            to keep previous msgids of translated messages,
45 #   --quiet               to reduce the verbosity.
46 MSGMERGE_OPTIONS = --quiet
48 MSGMERGE = msgmerge
49 MSGMERGE_UPDATE = @MSGMERGE@ --update
50 MSGCAT = msgcat
51 MSGINIT = msginit
52 MSGCONV = msgconv
53 MSGFILTER = msgfilter
55 # This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
56 POTFILES_DEPS = @POTFILES_DEPS@
58 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
59 POFILES = @POFILES@
60 # This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
61 UPDATEPOFILES = @UPDATEPOFILES@
62 # This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
63 DUMMYPOFILES = @DUMMYPOFILES@
64 # This is computed as $(foreach lang, $(LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
65 PROPERTIESFILES = @PROPERTIESFILES@
66 # This is computed as $(foreach lang, $(LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
67 CLASSFILES = @CLASSFILES@
69 # This is computed as
70 # $(foreach lang, user-specified subset of $(LINGUAS), $(DOMAIN)_$(lang).properties)
71 CATALOGS = @JAVACATALOGS@
73 SUFFIXES = .po .sed .sin .nop .po-create .po-update
75 .sin.sed:
76         sed -e '/^#/d' $< > t-$@
77         mv t-$@ $@
80 all-local: stamp-po
82 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
83 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
84 # we don't want to bother translators with empty POT files). We assume that
85 # LINGUAS is empty in this case, i.e. $(POFILES) and $(PROPERTIESFILES) are
86 # empty. In this case, stamp-po is a nop (i.e. a phony target).
88 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
89 # been loosely updated. Its purpose is that when a developer or translator
90 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
91 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
92 # invocations of "make" will do nothing. This timestamp would not be necessary
93 # if updating the $(CATALOGS) would always touch them; however, the rule for
94 # $(POFILES) has been designed to not touch files that don't need to be
95 # changed.
96 stamp-po: $(srcdir)/$(DOMAIN).pot
97         test -z "$(PROPERTIESFILES)" || $(MAKE) $(PROPERTIESFILES) \
98           $(MAKE) update-properties
99         @test ! -f $(srcdir)/$(DOMAIN).pot || { \
100           echo "touch stamp-po" && \
101           echo timestamp > stamp-poT && \
102           mv stamp-poT stamp-po; \
103         }
105 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
106 # otherwise packages like GCC can not be built if only parts of the source
107 # have been downloaded.
109 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
110 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
111 $(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
112         if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
113           package_gnu='GNU '; \
114         else \
115           package_gnu=''; \
116         fi; \
117         if test -n '$(MSGID_BUGS_ADDRESS)'; then \
118           msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
119         else \
120           msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
121         fi; \
122         case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
123           '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
124             $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
125               --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
126               --copyright-holder='$(COPYRIGHT_HOLDER)' \
127               --msgid-bugs-address="$$msgid_bugs_address" \
128               $(POTFILES) \
129             ;; \
130           *) \
131             $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
132               --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
133               --copyright-holder='$(COPYRIGHT_HOLDER)' \
134               --package-name="$${package_gnu}$(PACKAGE)" \
135               --package-version='$(VERSION)' \
136               --msgid-bugs-address="$$msgid_bugs_address" \
137               $(POTFILES) \
138             ;; \
139         esac
140         test ! -f $(DOMAIN).po || { \
141           if test -f $(srcdir)/$(DOMAIN).pot; then \
142             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
143             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
144             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
145               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
146             else \
147               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
148               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
149             fi; \
150           else \
151             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
152           fi; \
153         }
155 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
156 # every "make" invocation, only create it when it is missing.
157 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
158 $(srcdir)/$(DOMAIN).pot:
159         $(MAKE) $(DOMAIN).pot-update
161 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
162 # Note that a PO file is not touched if it doesn't need to be changed.
163 $(POFILES): $(srcdir)/$(DOMAIN).pot
164         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
165         if test -f "$(srcdir)/$${lang}.po"; then \
166           test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
167           echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
168           cd $(srcdir) \
169             && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
170                    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
171                      $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
172                    *) \
173                      $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
174                  esac; \
175                }; \
176         else \
177           $(MAKE) $${lang}.po-create; \
178         fi
181 html ID:
183 MOSTLYCLEANFILES =
184 MOSTLYCLEANFILES += remove-potcdate.sed
185 MOSTLYCLEANFILES += stamp-poT
186 MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
188 MAINTAINERCLEANFILES = stamp-po
190 EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES)
192 # Hidden from automake, but really activated. Works around an automake-1.5 bug.
193 #distdir: distdir1
194 distdir1:
195         $(MAKE) update-po
196         if test -f $(srcdir)/$(DOMAIN).pot; then \
197           for file in $(DOMAIN).pot stamp-po; do \
198             if test -f $$file; then d=.; else d=$(srcdir); fi; \
199             cp -p $$d/$$file $(distdir)/$$file || exit 1; \
200           done; \
201         fi
203 update-po: Makefile
204         $(MAKE) $(DOMAIN).pot-update
205         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
206         $(MAKE) update-properties
208 # General rule for creating PO files.
210 .nop.po-create:
211         @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
212         echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
213         exit 1
215 # General rule for updating PO files.
217 .nop.po-update:
218         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
219         tmpdir=`pwd`; \
220         echo "$$lang:"; \
221         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
222         echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
223         cd $(srcdir); \
224         if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
225                '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
226                  $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
227                *) \
228                  $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
229              esac; \
230            }; then \
231           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
232             rm -f $$tmpdir/$$lang.new.po; \
233           else \
234             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
235               :; \
236             else \
237               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
238               exit 1; \
239             fi; \
240           fi; \
241         else \
242           echo "msgmerge for $$lang.po failed!" 1>&2; \
243           rm -f $$tmpdir/$$lang.new.po; \
244         fi
246 $(DUMMYPOFILES):
248 update-properties: Makefile $(DOMAIN).pot $(POFILES)
249         @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \
250         $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; }
251         @for f in $(POFILES); do \
252           lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \
253           echo "$(GMSGFMT) -c --statistics --verbose -o /dev/null $(srcdir)/$${lang}.po"; \
254           $(GMSGFMT) -c --statistics --verbose -o /dev/null $(srcdir)/$${lang}.po || exit 1; \
255           echo "$(MSGCAT) --properties-output -o $(top_srcdir)/$(DOMAIN)_$$lang.properties $(srcdir)/$${lang}.po"; \
256           $(MSGCAT) --properties-output -o $(top_srcdir)/$(DOMAIN)_$$lang.properties.tmp $(srcdir)/$${lang}.po || exit 1; \
257           mv $(top_srcdir)/$(DOMAIN)_$$lang.properties.tmp $(top_srcdir)/$(DOMAIN)_$$lang.properties || exit 1; \
258         done
260 # Alternatively, we could create classes instead of properties files.
261 update-classes: Makefile $(DOMAIN).pot $(POFILES)
262         @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \
263         $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; }
264         @for f in $(POFILES); do \
265           lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \
266           echo "$(GMSGFMT) -c --statistics --verbose -j -d $(top_srcdir) -r $(DOMAIN) -l $${lang} $(srcdir)/$${lang}.po"; \
267           $(GMSGFMT) -c --statistics --verbose -j -d $(top_srcdir) -r $(DOMAIN) -l $${lang} $(srcdir)/$${lang}.po || exit 1; \
268         done
270 echo-catalogs:
271         @echo $(CATALOGS)