diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-09-29 01:20:17 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-09-29 12:04:52 +0100 |
commit | 76876bd5a95c3ce1ff6ccf3f633a6cce6fa4e5b2 (patch) | |
tree | efd42bee373804d903b37c7e9317407c4425ff9d /Debian | |
parent | 53d499e549e6eec5e319965cf2df1368120f2bca (diff) |
i18n: Source-level framework: call setlocale, provide __ and ___
This is the general plumbing for looking up translated messages - the
consumer-side. No actual messages are flagged for translation yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Debian')
-rw-r--r-- | Debian/Dgit.pm | 1 | ||||
-rw-r--r-- | Debian/Dgit/I18n.pm | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 91d4c71..6642917 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -33,6 +33,7 @@ use File::Path; use File::Basename; use Dpkg::Control::Hash; use Debian::Dgit::ExitStatus; +use Debian::Dgit::I18n; BEGIN { use Exporter (); diff --git a/Debian/Dgit/I18n.pm b/Debian/Dgit/I18n.pm new file mode 100644 index 0000000..c6f9e16 --- /dev/null +++ b/Debian/Dgit/I18n.pm @@ -0,0 +1,26 @@ +# -*- perl -*- + +package Debian::Dgit::I18n; + +# This module provides +# __ a function which is an alias for gettext +# ___ sprintf wrapper that gettexts the format +# +# In perl the sub `_' is a `superglobal', which means there +# is only one of it in the whole program and every reference +# is to the same one. So it's not really useable in modules. +# Hence __. + +use Locale::gettext; + +BEGIN { + use Exporter; + @ISA = qw(Exporter); + @EXPORT = qw(__ ___); +} + + +sub __ { gettext @_; } +sub ___ { my $f = shift @_; sprintf +(gettext $f), @_; } + +1; |