[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#686179: checks/po-debconf: please detect untranslatable templates



Package: lintian
Version: 2.5.10.1
Severity: wishlist
Tags: patch

Hi,

Please find attached a patch, so that Lintian may spot untranslatable
templates, thus violating Policy 3.9.1. I've tested it on a small set of
packages with success, but would be happy to run a more complete one (a
pointer on the way to do so would be welcome). The patch may also
probably be improved, I tried to keep the changes minimal and in line
with the rest.

I've also spotted a minor formatting issue, attached in [PATCH 1/2].

Regards

David

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-3-amd64 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils                       2.22-7.1
ii  bzip2                          1.0.6-4
ii  diffstat                       1.55-3
ii  file                           5.11-2
ii  gettext                        0.18.1.1-9
ii  hardening-includes             2.2
ii  intltool-debian                0.35.0+20060710.1
ii  libapt-pkg-perl                0.1.26+b1
ii  libarchive-zip-perl            1.30-6
ii  libc-bin                       2.13-35
ii  libclass-accessor-perl         0.34-1
ii  libclone-perl                  0.31-1+b2
ii  libdpkg-perl                   1.16.8
ii  libemail-valid-perl            0.190-1
ii  libipc-run-perl                0.91-1
ii  libparse-debianchangelog-perl  1.2.0-1
ii  libtimedate-perl               1.2000-1
ii  liburi-perl                    1.60-1
ii  locales                        2.13-35
ii  locales-all [locales]          2.13-35
ii  man-db                         2.6.2-1
ii  patchutils                     0.3.2-1.1
ii  perl [libdigest-sha-perl]      5.14.2-12

lintian recommends no packages.

Versions of packages lintian suggests:
pn  binutils-multiarch     <none>
ii  dpkg-dev               1.16.8
ii  libhtml-parser-perl    3.69-2
pn  libperlio-gzip-perl    <none>
ii  libtext-template-perl  1.45-2
ii  man-db                 2.6.2-1
ii  xz-utils [lzma]        5.1.1alpha+20120614-1

-- no debconf information

-- debsums errors found:
debsums: changed file /usr/share/lintian/checks/po-debconf (from lintian package)
debsums: changed file /usr/share/lintian/checks/po-debconf.desc (from lintian package)
>From 0c0d4de3c95000fe9d6320a16d9d9f486f8816e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Pr=C3=A9vot?= <taffit@debian.org>
Date: Tue, 28 Aug 2012 23:23:45 -0400
Subject: [PATCH 2/2] Add untranslatable-debconf-templates

---
 checks/po-debconf      |    9 +++++++++
 checks/po-debconf.desc |   15 +++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/checks/po-debconf b/checks/po-debconf
index e7d2074..7d8aeb0 100644
--- a/checks/po-debconf
+++ b/checks/po-debconf
@@ -44,6 +44,13 @@ for my $file (readdir(DEB)) {
     if ($file =~ m/^(.+\.)?templates(\..+)?$/) {
         if ($file =~ m/templates\.\w\w(_\w\w)?$/) {
             push (@lang_templates, $file);
+            open(PO, '<', "$debfiles/$file")
+                or fail("Can't open debfiles/$file file.");
+            while (<PO>) {
+                tag 'untranslatable-debconf-templates', "$file: $."
+                    if (m/^Description: (.+)/i and $1 !~/for internal use/);
+            }
+            close PO;
         } else {
             open(PO, '<', "$debfiles/$file")
                 or fail("Can't open debfiles/$file file.");
@@ -51,6 +58,8 @@ for my $file (readdir(DEB)) {
             while (<PO>) {
                 tag 'translated-default-field', "$file: $."
                     if (m/^_Default(Choice)?: [^\[]*$/);
+                tag 'untranslatable-debconf-templates', "$file: $."
+                    if (m/^Description: (.+)/i and $1 !~/for internal use/);
                 if (/^Template: (\S+)/i) {
                     my $template = $1;
                     next if $template =~ m,^shared/packages-(wordlist|ispell)$,;
diff --git a/checks/po-debconf.desc b/checks/po-debconf.desc
index d545f9c..acd15fb 100644
--- a/checks/po-debconf.desc
+++ b/checks/po-debconf.desc
@@ -16,6 +16,21 @@ Info: This package seems to be using debconf templates, but it does not
  that system.
 Ref: policy 3.9.1
 
+Tag: untranslatable-debconf-templates
+Severity: serious
+Certainty: possible
+Info: This package seems to be using debconf templates, but some
+ descriptions are not translatable.  You should prepend an underscore
+ before every translatable field, as described in po-debconf(7).  This
+ may mean that translators weren't properly warned about new strings.
+ .
+ Translators may be notified of changes using podebconf-report-po, for
+ example:
+ .
+  podebconf-report-po --call --withtranslators --deadline="+10 days" \
+  --languageteam
+Ref: policy 3.9.1
+
 Tag: stray-translated-debconf-templates
 Severity: normal
 Certainty: certain
-- 
1.7.10.4

>From 5d56e588909d1135319ede44bb98c32c8f571049 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Pr=C3=A9vot?= <taffit@debian.org>
Date: Tue, 28 Aug 2012 22:43:28 -0400
Subject: [PATCH 1/2] checks/po-debconf.desc: ffix

---
 checks/po-debconf.desc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/checks/po-debconf.desc b/checks/po-debconf.desc
index 709298d..d545f9c 100644
--- a/checks/po-debconf.desc
+++ b/checks/po-debconf.desc
@@ -103,7 +103,7 @@ Tag: no-complete-debconf-translation
 Severity: wishlist
 Certainty: possible
 Info: Even though this package provides debconf translation support, there 
- are no  translations or none of the translations are complete. This may 
+ are no translations or none of the translations are complete. This may 
  mean that translators weren't properly warned about new strings.
  .
  Translators may be notified of changes using podebconf-report-po, for
-- 
1.7.10.4


Reply to: