summaryrefslogtreecommitdiff
path: root/gettext-tools/examples/hello-perl/hello-1.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/examples/hello-perl/hello-1.pl.in')
-rw-r--r--gettext-tools/examples/hello-perl/hello-1.pl.in20
1 files changed, 20 insertions, 0 deletions
diff --git a/gettext-tools/examples/hello-perl/hello-1.pl.in b/gettext-tools/examples/hello-perl/hello-1.pl.in
new file mode 100644
index 0000000..0b16c8e
--- /dev/null
+++ b/gettext-tools/examples/hello-perl/hello-1.pl.in
@@ -0,0 +1,20 @@
+#!@PERL@
+# Example for use of GNU gettext.
+# This file is in the public domain.
+#
+# Source code of the Perl program, using the Locale::Messages API.
+
+use Locale::Messages qw (textdomain bindtextdomain gettext);
+use POSIX qw(getpid);
+
+binmode STDOUT, ':raw'; # Needed to make it work in UTF-8 locales in Perl-5.8.
+
+sub _ ($) { &gettext; }
+
+textdomain "hello-perl";
+bindtextdomain "hello-perl", "@localedir@";
+
+print _"Hello, world!";
+print "\n";
+printf _"This program is running as process number %d.", getpid();
+print "\n";