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

Dpkg::Gettext: Document public module

Guillem Jover лет назад: 11
Родитель
Сommit
726492a9c7
2 измененных файлов с 40 добавлено и 0 удалено
  1. 1 0
      debian/changelog
  2. 39 0
      scripts/Dpkg/Gettext.pm

+ 1 - 0
debian/changelog

@@ -22,6 +22,7 @@ dpkg (1.17.17) UNRELEASED; urgency=low
       Thanks to Johannes Schauer <j.schauer@email.de>.
     - New Dpkg::Getopt private module.
     - Document public module Dpkg.
+    - Document public module Dpkg::Gettext.
   * Set the DEB_TARGET_* dpkg-architecture variables from architecture.mk.
     Missed in dpkg 1.17.14.
   * Initialize DEB_TARGET_ARCH variable without requiring DEB_HOST_ARCH,

+ 39 - 0
scripts/Dpkg/Gettext.pm

@@ -28,6 +28,37 @@ use warnings;
 
 our $VERSION = '1.00';
 
+=encoding utf8
+
+=head1 NAME
+
+Dpkg::Gettext - convenience wrapper around Locale::gettext
+
+=head1 DESCRIPTION
+
+The Dpkg::Gettext module is a convenience wrapper over the Locale::gettext
+module, to guarantee we always have working gettext functions, and to add
+some commonly used aliases.
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item my $trans = _g($msgid)
+
+Calls gettext() on the $msgid and returns its translation for the current
+locale. If gettext() is not available, simply returns $msgid.
+
+=item my $trans = P_($msgid, $msgid_plural, $n)
+
+Calls ngettext(), returning the correct translation for the plural form
+dependent on $n. If gettext() is not available, returns $msgid if $n is 1
+or $msgid_plural otherwise.
+
+=back
+
+=cut
+
 BEGIN {
     eval 'use Locale::gettext';
     if ($@) {
@@ -64,4 +95,12 @@ BEGIN {
 use Exporter qw(import);
 our @EXPORT=qw(_g P_ textdomain ngettext);
 
+=head1 CHANGES
+
+=head2 Version 1.00
+
+Mark the module as public.
+
+=cut
+
 1;