Просмотр исходного кода

Dpkg::Gettext: Add new function N_

Guillem Jover лет назад: 10
Родитель
Сommit
9a54c92f8b
3 измененных файлов с 28 добавлено и 4 удалено
  1. 1 0
      debian/copyright
  2. 25 3
      scripts/Dpkg/Gettext.pm
  3. 2 1
      scripts/po/Makevars

+ 1 - 0
debian/copyright

@@ -65,6 +65,7 @@ Files:
  scripts/Dpkg/Gettext.pm
  scripts/Dpkg/Gettext.pm
 Copyright:
 Copyright:
  Copyright © 2000 Joey Hess <joeyh@debian.org>
  Copyright © 2000 Joey Hess <joeyh@debian.org>
+ Copyright © 2007, 2009-2010, 2012-2015 Guillem Jover <guillem@debian.org>
 License: BSD-2-clause
 License: BSD-2-clause
 
 
 Files:
 Files:

+ 25 - 3
scripts/Dpkg/Gettext.pm

@@ -1,5 +1,8 @@
 # Copied from /usr/share/perl5/Debconf/Gettext.pm
 # Copied from /usr/share/perl5/Debconf/Gettext.pm
 #
 #
+# Copyright © 2000 Joey Hess <joeyh@debian.org>
+# Copyright © 2007, 2009-2010, 2012-2015 Guillem Jover <guillem@debian.org>
+#
 # Redistribution and use in source and binary forms, with or without
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
 # modification, are permitted provided that the following conditions
 # are met:
 # are met:
@@ -26,12 +29,13 @@ package Dpkg::Gettext;
 use strict;
 use strict;
 use warnings;
 use warnings;
 
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
 our @EXPORT = qw(
 our @EXPORT = qw(
     textdomain
     textdomain
     ngettext
     ngettext
     g_
     g_
     P_
     P_
+    N_
     _g
     _g
 );
 );
 
 
@@ -89,8 +93,6 @@ Calls dngettext(), returning the correct translation for the plural form
 dependent on $n. If dngettext() is not available, returns $msgid if $n is 1
 dependent on $n. If dngettext() is not available, returns $msgid if $n is 1
 or $msgid_plural otherwise.
 or $msgid_plural otherwise.
 
 
-=back
-
 =cut
 =cut
 
 
 use constant GETTEXT_CONTEXT_GLUE => "\004";
 use constant GETTEXT_CONTEXT_GLUE => "\004";
@@ -137,6 +139,22 @@ BEGIN {
     }
     }
 }
 }
 
 
+=item $msgid = N_($msgid)
+
+A pseudo function that servers as a marked for automated extraction of
+messages, but does not call gettext(). The run-time translation is done
+at a different place in the code.
+
+=back
+
+=cut
+
+sub N_
+{
+    my $msgid = shift;
+    return $msgid;
+}
+
 # XXX: Backwards compatibility, to be removed on VERSION 2.00.
 # XXX: Backwards compatibility, to be removed on VERSION 2.00.
 sub _g ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
 sub _g ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
 {
 {
@@ -150,6 +168,10 @@ sub _g ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
 
 
 =head1 CHANGES
 =head1 CHANGES
 
 
+=head2 Version 1.02 (dpkg 1.18.3)
+
+New function: N_().
+
 =head2 Version 1.01 (dpkg 1.18.0)
 =head2 Version 1.01 (dpkg 1.18.0)
 
 
 Now the short aliases (g_ and P_) will call domain aware functions with
 Now the short aliases (g_ and P_) will call domain aware functions with

+ 2 - 1
scripts/po/Makevars

@@ -9,7 +9,8 @@ top_builddir = ../..
 
 
 # These options get passed to xgettext.
 # These options get passed to xgettext.
 XGETTEXT_OPTIONS = --from-code=UTF-8 --add-location=file \
 XGETTEXT_OPTIONS = --from-code=UTF-8 --add-location=file \
-                   --keyword --keyword=g_ --keyword=P_:1,2
+                   --keyword --keyword=g_ --keyword=N_ \
+                   --keyword=P_:1,2 --keyword=C_:1c,2
 
 
 # This is the copyright holder that gets inserted into the header of the
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding