1# Example for use of GNU gettext. 2# This file is in the public domain. 3# 4# Makefile configuration - processed by automake. 5 6# List of files which contain translatable strings. 7POTFILES = \ 8 hello.tcl 9 10# Usually the message domain is the same as the package name. 11DOMAIN = $(PACKAGE) 12 13# These options get passed to xgettext. 14XGETTEXT_OPTIONS = --keyword=_ --flag=_:1:pass-tcl-format 15 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. 24COPYRIGHT_HOLDER = Yoyodyne, Inc. 25 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. 40MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org 41 42MSGMERGE = msgmerge 43MSGMERGE_UPDATE = @MSGMERGE@ --update 44MSGINIT = msginit 45MSGCONV = msgconv 46MSGFILTER = msgfilter 47 48# This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) 49POTFILES_DEPS = @POTFILES_DEPS@ 50 51# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po) 52POFILES = @POFILES@ 53# This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update) 54UPDATEPOFILES = @UPDATEPOFILES@ 55# This is computed as $(foreach lang, $(LINGUAS), $(lang).nop) 56DUMMYPOFILES = @DUMMYPOFILES@ 57# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(frob $(lang)).msg) 58MSGFILES = @MSGFILES@ 59 60# This is computed as 61# $(foreach lang, user-specified subset of $(LINGUAS), $(frob $(lang)).msg) 62CATALOGS = @TCLCATALOGS@ 63 64SUFFIXES = .sed .sin .nop .po-create .po-update 65 66.sin.sed: 67 sed -e '/^#/d' $< > t-$@ 68 mv t-$@ $@ 69 70 71all-local: all-local-@USE_NLS@ 72 73all-local-yes: stamp-po 74all-local-no: 75 76# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no 77# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because 78# we don't want to bother translators with empty POT files). We assume that 79# LINGUAS is empty in this case, i.e. $(POFILES) and $(MSGFILES) are empty. 80# In this case, stamp-po is a nop (i.e. a phony target). 81 82# stamp-po is a timestamp denoting the last time at which the CATALOGS have 83# been loosely updated. Its purpose is that when a developer or translator 84# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, 85# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent 86# invocations of "make" will do nothing. This timestamp would not be necessary 87# if updating the $(CATALOGS) would always touch them; however, the rule for 88# $(POFILES) has been designed to not touch files that don't need to be 89# changed. 90stamp-po: $(srcdir)/$(DOMAIN).pot 91 test ! -f $(srcdir)/$(DOMAIN).pot || \ 92 test -z "$(MSGFILES)" || $(MAKE) $(MSGFILES) 93 @test ! -f $(srcdir)/$(DOMAIN).pot || { \ 94 echo "touch stamp-po" && \ 95 echo timestamp > stamp-poT && \ 96 mv stamp-poT stamp-po; \ 97 } 98 99# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', 100# otherwise packages like GCC can not be built if only parts of the source 101# have been downloaded. 102 103# This target rebuilds $(DOMAIN).pot; it is an expensive operation. 104# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. 105$(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed 106 if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \ 107 package_gnu='GNU '; \ 108 else \ 109 package_gnu=''; \ 110 fi; \ 111 if test -n '$(MSGID_BUGS_ADDRESS)'; then \ 112 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ 113 else \ 114 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ 115 fi; \ 116 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ 117 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ 118 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ 119 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ 120 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 121 --msgid-bugs-address="$$msgid_bugs_address" \ 122 $(POTFILES) \ 123 ;; \ 124 *) \ 125 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ 126 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ 127 --copyright-holder='$(COPYRIGHT_HOLDER)' \ 128 --package-name="$${package_gnu}$(PACKAGE)" \ 129 --package-version='$(VERSION)' \ 130 --msgid-bugs-address="$$msgid_bugs_address" \ 131 $(POTFILES) \ 132 ;; \ 133 esac 134 test ! -f $(DOMAIN).po || { \ 135 if test -f $(srcdir)/$(DOMAIN).pot; then \ 136 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ 137 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ 138 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ 139 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ 140 else \ 141 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ 142 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ 143 fi; \ 144 else \ 145 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ 146 fi; \ 147 } 148 149# This rule has no dependencies: we don't need to update $(DOMAIN).pot at 150# every "make" invocation, only create it when it is missing. 151# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. 152$(srcdir)/$(DOMAIN).pot: 153 $(MAKE) $(DOMAIN).pot-update 154 155# This target rebuilds a PO file if $(DOMAIN).pot has changed. 156# Note that a PO file is not touched if it doesn't need to be changed. 157$(POFILES): $(srcdir)/$(DOMAIN).pot 158 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ 159 if test -f "$(srcdir)/$${lang}.po"; then \ 160 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 161 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ 162 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ 163 else \ 164 $(MAKE) $${lang}.po-create; \ 165 fi 166 167 168install-data-local: install-data-local-@USE_NLS@ 169install-data-local-no: all-local 170install-data-local-yes: all-local 171 $(mkdir_p) $(DESTDIR)$(pkgdatadir)/msgs 172 @catalogs='$(CATALOGS)'; \ 173 for cat in $$catalogs; do \ 174 cat=`basename $$cat`; \ 175 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ 176 $(INSTALL_DATA) $$realcat $(DESTDIR)$(pkgdatadir)/msgs/$$cat; \ 177 echo "installing $$realcat as $(DESTDIR)$(pkgdatadir)/msgs/$$cat"; \ 178 done 179 180installdirs-local: installdirs-local-@USE_NLS@ 181installdirs-local-no: 182installdirs-local-yes: 183 $(mkdir_p) $(DESTDIR)$(pkgdatadir)/msgs 184 185uninstall-local: uninstall-local-@USE_NLS@ 186uninstall-local-no: 187uninstall-local-yes: 188 catalogs='$(CATALOGS)'; \ 189 for cat in $$catalogs; do \ 190 cat=`basename $$cat`; \ 191 rm -f $(DESTDIR)$(pkgdatadir)/msgs/$$cat; \ 192 done 193 194html ID: 195 196MOSTLYCLEANFILES = 197MOSTLYCLEANFILES += remove-potcdate.sed 198MOSTLYCLEANFILES += stamp-poT 199MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po 200MOSTLYCLEANFILES += *.o 201 202MAINTAINERCLEANFILES = stamp-po $(MSGFILES) 203 204EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(MSGFILES) 205 206# Hidden from automake, but really activated. Works around an automake-1.5 bug. 207#distdir: distdir1 208distdir1: 209 $(MAKE) update-po 210 if test -f $(srcdir)/$(DOMAIN).pot; then \ 211 for file in $(DOMAIN).pot stamp-po; do \ 212 if test -f $$file; then d=.; else d=$(srcdir); fi; \ 213 cp -p $$d/$$file $(distdir)/$$file || exit 1; \ 214 done; \ 215 fi 216 217update-po: Makefile 218 $(MAKE) $(DOMAIN).pot-update 219 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) 220 $(MAKE) update-msg 221 222# General rule for creating PO files. 223 224.nop.po-create: 225 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ 226 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ 227 exit 1 228 229# General rule for updating PO files. 230 231.nop.po-update: 232 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ 233 tmpdir=`pwd`; \ 234 echo "$$lang:"; \ 235 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ 236 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ 237 cd $(srcdir); \ 238 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ 239 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 240 rm -f $$tmpdir/$$lang.new.po; \ 241 else \ 242 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 243 :; \ 244 else \ 245 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 246 exit 1; \ 247 fi; \ 248 fi; \ 249 else \ 250 echo "msgmerge for $$lang.po failed!" 1>&2; \ 251 rm -f $$tmpdir/$$lang.new.po; \ 252 fi 253 254$(DUMMYPOFILES): 255 256update-msg: Makefile $(MSGFILES) 257 @: 258