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.
10 # Usually the message domain is the same as the package name.
13 # These options get passed to xgettext.
15 --keyword=wxGetTranslation:1 --keyword=wxGetTranslation:1,2 \
16 --flag=wxGetTranslation:1:pass-c-format --flag=wxGetTranslation:2:pass-c-format \
17 --keyword=wxTRANSLATE --flag=wxTRANSLATE:1:pass-c-format \
18 --keyword=wxPLURAL:1,2 --flag=wxPLURAL:1:pass-c-format --flag=wxPLURAL:2:pass-c-format \
19 --keyword=_ --flag=_:1:pass-c-format \
20 --keyword=N_ --flag=N_:1:pass-c-format
22 # This is the copyright holder that gets inserted into the header of the
23 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
24 # package. (Note that the msgstr strings, extracted from the package's
25 # sources, belong to the copyright holder of the package.) Translators are
26 # expected to transfer the copyright for their translations to this person
27 # or entity, or to disclaim their copyright. The empty string stands for
28 # the public domain; in this case the translators are expected to disclaim
30 COPYRIGHT_HOLDER = Yoyodyne, Inc.
32 # This is the email address or URL to which the translators shall report
33 # bugs in the untranslated strings:
34 # - Strings which are not entire sentences, see the maintainer guidelines
35 # in the GNU gettext documentation, section 'Preparing Strings'.
36 # - Strings which use unclear terms or require additional context to be
38 # - Strings which make invalid assumptions about notation of date, time or
40 # - Pluralisation problems.
41 # - Incorrect English spelling.
42 # - Incorrect formatting.
43 # It can be your email address, or a mailing list address where translators
44 # can write to without being subscribed, or the URL of a web page through
45 # which the translators can contact you.
46 MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
48 # This is the list of locale categories, beyond LC_MESSAGES, for which the
49 # message catalogs shall be used. It is usually empty.
50 EXTRA_LOCALE_CATEGORIES =
52 # These options get passed to msgmerge.
53 # Useful options are in particular:
54 # --previous to keep previous msgids of translated messages,
55 # --quiet to reduce the verbosity.
56 MSGMERGE_OPTIONS = --quiet
59 MSGMERGE_UPDATE = @MSGMERGE@ --update
64 # This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
65 POTFILES_DEPS = @POTFILES_DEPS@
67 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
69 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).gmo)
71 # This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
72 UPDATEPOFILES = @UPDATEPOFILES@
73 # This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
74 DUMMYPOFILES = @DUMMYPOFILES@
77 # $(foreach lang, user-specified subset of $(LINGUAS), $(lang).gmo)
80 SUFFIXES = .po .gmo .mo .sed .sin .nop .po-create .po-update
83 @echo "$(MSGFMT) -c -o $@ $<"; \
84 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
87 @lang=`echo $* | sed -e 's,.*/,,'`; \
88 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
89 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
90 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
93 sed -e '/^#/d' $< > t-$@
97 all-local: all-local-@USE_NLS@
99 all-local-yes: stamp-po
102 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
103 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
104 # we don't want to bother translators with empty POT files). We assume that
105 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
106 # In this case, stamp-po is a nop (i.e. a phony target).
108 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
109 # been loosely updated. Its purpose is that when a developer or translator
110 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
111 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
112 # invocations of "make" will do nothing. This timestamp would not be necessary
113 # if updating the $(CATALOGS) would always touch them; however, the rule for
114 # $(POFILES) has been designed to not touch files that don't need to be
116 stamp-po: $(srcdir)/$(DOMAIN).pot
117 test ! -f $(srcdir)/$(DOMAIN).pot || \
118 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
119 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
120 echo "touch stamp-po" && \
121 echo timestamp > stamp-poT && \
122 mv stamp-poT stamp-po; \
125 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
126 # otherwise packages like GCC can not be built if only parts of the source
127 # have been downloaded.
129 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
130 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
131 $(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
132 if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
133 package_gnu='GNU '; \
137 if test -n '$(MSGID_BUGS_ADDRESS)'; then \
138 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
140 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
142 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
143 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
144 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
145 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
146 --copyright-holder='$(COPYRIGHT_HOLDER)' \
147 --msgid-bugs-address="$$msgid_bugs_address" \
151 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
152 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
153 --copyright-holder='$(COPYRIGHT_HOLDER)' \
154 --package-name="$${package_gnu}$(PACKAGE)" \
155 --package-version='$(VERSION)' \
156 --msgid-bugs-address="$$msgid_bugs_address" \
160 test ! -f $(DOMAIN).po || { \
161 if test -f $(srcdir)/$(DOMAIN).pot; then \
162 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
163 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
164 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
165 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
167 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
168 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
171 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
175 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
176 # every "make" invocation, only create it when it is missing.
177 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
178 $(srcdir)/$(DOMAIN).pot:
179 $(MAKE) $(DOMAIN).pot-update
181 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
182 # Note that a PO file is not touched if it doesn't need to be changed.
183 $(POFILES): $(srcdir)/$(DOMAIN).pot
184 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
185 if test -f "$(srcdir)/$${lang}.po"; then \
186 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
187 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
189 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
190 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
191 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
193 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
197 $(MAKE) $${lang}.po-create; \
201 install-data-local: install-data-local-@USE_NLS@
202 install-data-local-no: all-local
203 install-data-local-yes: all-local
204 $(mkdir_p) $(DESTDIR)$(datadir)
205 @catalogs='$(CATALOGS)'; \
206 for cat in $$catalogs; do \
207 cat=`basename $$cat`; \
208 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
209 dir=$(localedir)/$$lang/LC_MESSAGES; \
210 $(mkdir_p) $(DESTDIR)$$dir; \
211 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
212 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
213 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
214 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
215 if test -n "$$lc"; then \
216 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
217 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
218 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
219 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
220 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
222 if test -f $$file; then \
223 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
226 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
228 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
231 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
232 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
235 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
236 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
237 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
238 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
239 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
244 installdirs-local: installdirs-local-@USE_NLS@
245 installdirs-local-no:
246 installdirs-local-yes:
247 $(mkdir_p) $(DESTDIR)$(datadir)
248 @catalogs='$(CATALOGS)'; \
249 for cat in $$catalogs; do \
250 cat=`basename $$cat`; \
251 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
252 dir=$(localedir)/$$lang/LC_MESSAGES; \
253 $(mkdir_p) $(DESTDIR)$$dir; \
254 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
255 if test -n "$$lc"; then \
256 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
257 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
258 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
259 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
260 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
262 if test -f $$file; then \
263 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
266 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
268 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
271 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
272 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
279 uninstall-local: uninstall-local-@USE_NLS@
282 catalogs='$(CATALOGS)'; \
283 for cat in $$catalogs; do \
284 cat=`basename $$cat`; \
285 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
286 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
287 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
294 MOSTLYCLEANFILES += remove-potcdate.sed
295 MOSTLYCLEANFILES += stamp-poT
296 MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
297 MOSTLYCLEANFILES += *.o
299 DISTCLEANFILES = *.mo
301 MAINTAINERCLEANFILES = stamp-po $(GMOFILES)
303 EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(GMOFILES)
305 # Hidden from automake, but really activated. Works around an automake-1.5 bug.
309 if test -f $(srcdir)/$(DOMAIN).pot; then \
310 for file in $(DOMAIN).pot stamp-po; do \
311 if test -f $$file; then d=.; else d=$(srcdir); fi; \
312 cp -p $$d/$$file $(distdir)/$$file || exit 1; \
317 $(MAKE) $(DOMAIN).pot-update
318 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
321 # General rule for creating PO files.
324 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
325 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
328 # General rule for updating PO files.
331 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
334 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
335 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
337 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
338 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
339 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
341 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
344 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
345 rm -f $$tmpdir/$$lang.new.po; \
347 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
350 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
355 echo "msgmerge for $$lang.po failed!" 1>&2; \
356 rm -f $$tmpdir/$$lang.new.po; \
361 update-gmo: Makefile $(GMOFILES)