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