chiark / gitweb /
i18n: Provide i_ (identity function, tags for translation)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 29 Sep 2018 12:02:51 +0000 (13:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Sep 2018 00:51:09 +0000 (01:51 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit/I18n.pm
po/Makefile

index 9c474eefb9c4df9132c1653aaaa9d35ddcd61482..e8068ff366bcb4e3170c85e05073addef87c885e 100644 (file)
@@ -5,6 +5,7 @@ package Debian::Dgit::I18n;
 # This module provides
 #    __       a function which is an alias for gettext
 #    f_       sprintf wrapper that gettexts the format
+#    i_       identify function, but marks string for translation
 #
 # In perl the sub `_' is a `superglobal', which means there
 # is only one of it in the whole program and every reference
@@ -16,11 +17,12 @@ use Locale::gettext;
 BEGIN {
     use Exporter;
     @ISA = qw(Exporter);
-    @EXPORT = qw(__ f_);
+    @EXPORT = qw(__ f_ i_);
 }
 
 
 sub __ ($) { gettext @_; }
+sub i_ ($) { $_[0]; }
 sub f_ ($$;@) { my $f = shift @_; sprintf +(gettext $f), @_; }
 
 1;
index 2ba5e6078a20825e994a5e1c09498d5b88aa8b62..9865c8aba8a709123435d6f3d2ead6abd0d88497 100644 (file)
@@ -84,7 +84,7 @@ messages.pot: $(if $(SUPPRESS_PO_UPDATE),,$(POTS))
 %.mo: %.po
        $S msgfmt -o $@ $<
 
-XGETTEXT_OPTS += -Lperl -k__ -kf_
+XGETTEXT_OPTS += -Lperl -k__ -kf_ -ki_
 XGETTEXT_OPTS += --from-code=UTF-8
 XGETTEXT_OPTS += --package-name=dgit --package-version=ongoing
 # The --package-* avoids this error from make check's `msgfmt -c'