From f267017422adea03967b5cf66426e4229c3ff46b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 29 Sep 2018 13:02:51 +0100 Subject: [PATCH] i18n: Provide i_ (identity function, tags for translation) Signed-off-by: Ian Jackson --- Debian/Dgit/I18n.pm | 4 +++- po/Makefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Debian/Dgit/I18n.pm b/Debian/Dgit/I18n.pm index 9c474eef..e8068ff3 100644 --- a/Debian/Dgit/I18n.pm +++ b/Debian/Dgit/I18n.pm @@ -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; diff --git a/po/Makefile b/po/Makefile index 2ba5e607..9865c8ab 100644 --- a/po/Makefile +++ b/po/Makefile @@ -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' -- 2.30.2