chiark / gitweb /
changelog: start 9.14
[dgit.git] / Debian / Dgit / I18n.pm
1 # -*- perl -*-
2
3 package Debian::Dgit::I18n;
4
5 # This module provides
6 #    __       a function which is an alias for gettext
7 #    f_       sprintf wrapper that gettexts the format
8 #    i_       identify function, but marks string for translation
9 #
10 # In perl the sub `_' is a `superglobal', which means there
11 # is only one of it in the whole program and every reference
12 # is to the same one.  So it's not really useable in modules.
13 # Hence __.
14
15 use Locale::gettext;
16
17 BEGIN {
18     use Exporter;
19     @ISA = qw(Exporter);
20     @EXPORT = qw(__ f_ i_);
21 }
22
23
24 sub __ ($) { gettext @_; }
25 sub i_ ($) { $_[0]; }
26 sub f_ ($$;@) { my $f = shift @_; sprintf +(gettext $f), @_; }
27
28 1;