]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Hello-world example with Scheme (guile).
authorBruno Haible <bruno@clisp.org>
Tue, 18 Jan 2005 11:45:05 +0000 (11:45 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:06 +0000 (12:12 +0200)
gettext-tools/examples/hello-guile/INSTALL [new file with mode: 0644]
gettext-tools/examples/hello-guile/Makefile.am [new file with mode: 0644]
gettext-tools/examples/hello-guile/autoclean.sh [new file with mode: 0755]
gettext-tools/examples/hello-guile/autogen.sh [new file with mode: 0755]
gettext-tools/examples/hello-guile/configure.ac [new file with mode: 0644]
gettext-tools/examples/hello-guile/hello.scm [new file with mode: 0644]
gettext-tools/examples/hello-guile/m4/Makefile.am [new file with mode: 0644]
gettext-tools/examples/hello-guile/po/.cvsignore [new file with mode: 0644]
gettext-tools/examples/hello-guile/po/LINGUAS [new file with mode: 0644]
gettext-tools/examples/hello-guile/po/Makefile.am [new file with mode: 0644]

diff --git a/gettext-tools/examples/hello-guile/INSTALL b/gettext-tools/examples/hello-guile/INSTALL
new file mode 100644 (file)
index 0000000..c48052f
--- /dev/null
@@ -0,0 +1,10 @@
+This example relies on GNU guile.
+
+Installation:
+  ./autogen.sh
+  ./configure --prefix=/some/prefix
+  make
+  make install
+Cleanup:
+  make distclean
+  ./autoclean.sh
diff --git a/gettext-tools/examples/hello-guile/Makefile.am b/gettext-tools/examples/hello-guile/Makefile.am
new file mode 100644 (file)
index 0000000..212d2a8
--- /dev/null
@@ -0,0 +1,18 @@
+# Example for use of GNU gettext.
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This file is in the public domain.
+#
+# Makefile configuration - processed by automake.
+
+# General automake options.
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+
+# The list of subdirectories containing Makefiles.
+SUBDIRS = m4 po
+
+# The list of programs that are built.
+bin_SCRIPTS = hello
+
+# Additional files to be distributed.
+EXTRA_DIST = autogen.sh autoclean.sh
diff --git a/gettext-tools/examples/hello-guile/autoclean.sh b/gettext-tools/examples/hello-guile/autoclean.sh
new file mode 100755 (executable)
index 0000000..a309cee
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Example for use of GNU gettext.
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This file is in the public domain.
+#
+# Script for cleaning all autogenerated files.
+
+test ! -f Makefile || make distclean
+
+# Brought in by explicit copy.
+rm -f m4/nls.m4
+rm -f m4/po.m4
+rm -f po/remove-potcdate.sin
+
+# Generated by aclocal.
+rm -f aclocal.m4
+
+# Generated by autoconf.
+rm -f configure
+
+# Generated or brought in by automake.
+rm -f Makefile.in
+rm -f m4/Makefile.in
+rm -f po/Makefile.in
+rm -f install-sh
+rm -f mkinstalldirs
+rm -f missing
+rm -f po/*.pot
+rm -f po/stamp-po
+rm -f po/*.gmo
diff --git a/gettext-tools/examples/hello-guile/autogen.sh b/gettext-tools/examples/hello-guile/autogen.sh
new file mode 100755 (executable)
index 0000000..dc73bff
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Example for use of GNU gettext.
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This file is in the public domain.
+#
+# Script for regenerating all autogenerated files.
+
+test -r ../Makefile.am || . ../installpaths
+
+cp -p ${ACLOCALDIR-../../../gettext-runtime/m4}/nls.m4 m4/nls.m4
+cp -p ${ACLOCALDIR-../../../gettext-runtime/m4}/po.m4 m4/po.m4
+cp -p ${GETTEXTSRCPODIR-../../../gettext-runtime/po}/remove-potcdate.sin po/remove-potcdate.sin
+
+aclocal -I m4
+
+autoconf
+
+automake -a -c
+
+cd po
+for f in *.po; do
+  if test -r "$f"; then
+    lang=`echo $f | sed -e 's,\.po$,,'`
+    msgfmt -c -o $lang.gmo $lang.po
+  fi
+done
+cd ..
diff --git a/gettext-tools/examples/hello-guile/configure.ac b/gettext-tools/examples/hello-guile/configure.ac
new file mode 100644 (file)
index 0000000..42b95ee
--- /dev/null
@@ -0,0 +1,39 @@
+dnl Example for use of GNU gettext.
+dnl Copyright (C) 2003-2005 Free Software Foundation, Inc.
+dnl This file is in the public domain.
+dnl
+dnl Configuration file - processed by autoconf.
+
+AC_INIT
+AC_CONFIG_SRCDIR(hello.scm)
+AM_INIT_AUTOMAKE(hello-guile, 0)
+
+dnl Check for availability of the guile interpreter.
+AC_PATH_PROG(GUILE, guile)
+if test -z "$GUILE"; then
+  echo "*** Essential program guile not found" 1>&2
+  exit 1
+fi
+AC_SUBST(GUILE)
+
+dnl The installed program must know where to find its message catalogs.
+dnl Unfortunately, prefix gets only finally determined at the end of configure.
+if test "X$prefix" = "XNONE"; then
+  final_prefix="$ac_default_prefix"
+else
+  final_prefix="$prefix"
+fi
+save_prefix="$prefix"
+prefix="$final_prefix"
+eval "localedir=\"${datadir}/locale\""
+prefix="$save_prefix"
+AC_SUBST(localedir)
+
+dnl Support for the po directory.
+AM_PO_SUBDIRS
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([hello:hello.scm], [chmod a+x hello])
+AC_CONFIG_FILES([m4/Makefile])
+AC_CONFIG_FILES([po/Makefile], [AM_POSTPROCESS_PO_MAKEFILE])
+AC_OUTPUT
diff --git a/gettext-tools/examples/hello-guile/hello.scm b/gettext-tools/examples/hello-guile/hello.scm
new file mode 100644 (file)
index 0000000..9e8a4c3
--- /dev/null
@@ -0,0 +1,18 @@
+#!@GUILE@ -s
+!#
+;;; Example for use of GNU gettext.
+;;; Copyright (C) 2004-2005 Free Software Foundation, Inc.
+;;; This file is in the public domain.
+
+;;; Source code of the GNU guile program.
+
+(use-modules (ice-9 format))
+
+(textdomain "hello-guile")
+(bindtextdomaindir "hello-guile" "@localedir@")
+(define _ gettext)
+
+(display (_ "Hello, world!"))
+(newline)
+(format #t (_ "This program is running as process number ~D.") (getpid))
+(newline)
diff --git a/gettext-tools/examples/hello-guile/m4/Makefile.am b/gettext-tools/examples/hello-guile/m4/Makefile.am
new file mode 100644 (file)
index 0000000..8a841b3
--- /dev/null
@@ -0,0 +1,2 @@
+EXTRA_DIST = \
+  nls.m4 po.m4
diff --git a/gettext-tools/examples/hello-guile/po/.cvsignore b/gettext-tools/examples/hello-guile/po/.cvsignore
new file mode 100644 (file)
index 0000000..6d609ce
--- /dev/null
@@ -0,0 +1 @@
+*.po
diff --git a/gettext-tools/examples/hello-guile/po/LINGUAS b/gettext-tools/examples/hello-guile/po/LINGUAS
new file mode 100644 (file)
index 0000000..5f03484
--- /dev/null
@@ -0,0 +1,6 @@
+# Example for use of GNU gettext.
+# Copyright (C) 2003-2005 Free Software Foundation, Inc.
+# This file is in the public domain.
+#
+# Set of available languages.
+af ca de el es fr ja nl pl ro ru sk sr sv tr uk zh_CN
diff --git a/gettext-tools/examples/hello-guile/po/Makefile.am b/gettext-tools/examples/hello-guile/po/Makefile.am
new file mode 100644 (file)
index 0000000..fa49491
--- /dev/null
@@ -0,0 +1,302 @@
+# Example for use of GNU gettext.
+# Copyright (C) 2003-2004 Free Software Foundation, Inc.
+# This file is in the public domain.
+#
+# Makefile configuration - processed by automake.
+
+# List of files which contain translatable strings.
+POTFILES = \
+  hello.scm
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --flag=_:1:pass-scheme-format
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Yoyodyne, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+localedir = $(datadir)/locale
+
+MSGMERGE = msgmerge
+MSGMERGE_UPDATE = @MSGMERGE@ --update
+MSGINIT = msginit
+MSGCONV = msgconv
+MSGFILTER = msgfilter
+
+# This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
+POTFILES_DEPS = @POTFILES_DEPS@
+
+# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
+POFILES = @POFILES@
+# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).gmo)
+GMOFILES = @GMOFILES@
+# This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
+UPDATEPOFILES = @UPDATEPOFILES@
+# This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
+DUMMYPOFILES = @DUMMYPOFILES@
+
+# This is computed as
+# $(foreach lang, user-specified subset of $(LINGUAS), $(lang).gmo)
+CATALOGS = @CATALOGS@
+
+SUFFIXES = .po .gmo .mo .sed .sin .nop .po-create .po-update
+
+.po.mo:
+       @echo "$(MSGFMT) -c -o $@ $<"; \
+       $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+       @lang=`echo $* | sed -e 's,.*/,,'`; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
+       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+.sin.sed:
+       sed -e '/^#/d' $< > t-$@
+       mv t-$@ $@
+
+
+all-local: all-local-@USE_NLS@
+
+all-local-yes: stamp-po
+all-local-no:
+
+# stamp-po is a timestamp denoting the last time at which the CATALOGS have
+# been loosely updated. Its purpose is that when a developer or translator
+# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
+# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
+# invocations of "make" will do nothing. This timestamp would not be necessary
+# if updating the $(CATALOGS) would always touch them; however, the rule for
+# $(POFILES) has been designed to not touch files that don't need to be
+# changed.
+stamp-po: $(srcdir)/$(DOMAIN).pot
+       test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+       @echo "touch stamp-po"
+       @echo timestamp > stamp-poT
+       @mv stamp-poT stamp-po
+
+# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
+# otherwise packages like GCC can not be built if only parts of the source
+# have been downloaded.
+
+# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
+# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+$(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
+       $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+         --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
+         --copyright-holder='$(COPYRIGHT_HOLDER)' \
+         --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' \
+         $(POTFILES)
+       test ! -f $(DOMAIN).po || { \
+         if test -f $(srcdir)/$(DOMAIN).pot; then \
+           sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+           sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+           if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
+           else \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
+             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+           fi; \
+         else \
+           mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+         fi; \
+       }
+
+# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
+# every "make" invocation, only create it when it is missing.
+# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
+$(srcdir)/$(DOMAIN).pot:
+       $(MAKE) $(DOMAIN).pot-update
+
+# This target rebuilds a PO file if $(DOMAIN).pot has changed.
+# Note that a PO file is not touched if it doesn't need to be changed.
+$(POFILES): $(srcdir)/$(DOMAIN).pot
+       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
+       if test -f "$(srcdir)/$${lang}.po"; then \
+         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
+         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
+       else \
+         $(MAKE) $${lang}.po-create; \
+       fi
+
+
+install-data-local: install-data-local-@USE_NLS@
+install-data-local-no: all-local
+install-data-local-yes: all-local
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+         $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+         echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+           fi; \
+         done; \
+       done
+
+installdirs-local: installdirs-local-@USE_NLS@
+installdirs-local-no:
+installdirs-local-yes:
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+           fi; \
+         done; \
+       done
+
+uninstall-local: uninstall-local-@USE_NLS@
+uninstall-local-no:
+uninstall-local-yes:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+           rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+         done; \
+       done
+
+html ID:
+
+MOSTLYCLEANFILES =
+MOSTLYCLEANFILES += remove-potcdate.sed
+MOSTLYCLEANFILES += stamp-poT
+MOSTLYCLEANFILES += core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+MOSTLYCLEANFILES += *.o
+
+DISTCLEANFILES = *.mo
+
+MAINTAINERCLEANFILES = stamp-po $(GMOFILES)
+
+EXTRA_DIST = remove-potcdate.sin LINGUAS $(DOMAIN).pot stamp-po $(POFILES) $(GMOFILES)
+
+# Hidden from automake, but really activated. Works around an automake-1.5 bug.
+#distdir: distdir1
+distdir1:
+       $(MAKE) update-po
+
+update-po: Makefile
+       $(MAKE) $(DOMAIN).pot-update
+       test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
+       $(MAKE) update-gmo
+
+# General rule for creating PO files.
+
+.nop.po-create:
+       @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
+       echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
+       exit 1
+
+# General rule for updating PO files.
+
+.nop.po-update:
+       @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       cd $(srcdir); \
+       if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "msgmerge for $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+$(DUMMYPOFILES):
+
+update-gmo: Makefile $(GMOFILES)
+       @: