tags 388824 patch thanks Hi, Thijs Kinkhorst <thijs@debian.org> (22/09/2006): > Our package uses a translated DefaultChoice field in the debconf > templates, exactly as described in DevRef 6.5.4.4. > > Lintian triggers a warning on this: select-with-translated-default-field. > Since the warning doesn't apply, I'm overriding it. However, the warning > is triggered for every occurrence in every po file. That means I'm now > putting two overrides per language in our lintian-overrides file: > > select-with-translated-default-field mailman/site_languages hu.utf-8 > select-with-translated-default-field mailman/default_server_language hu.utf-8 > select-with-translated-default-field mailman/site_languages ja.utf-8 > select-with-translated-default-field mailman/default_server_language ja.utf-8 > [...] > > I think you'll get my point: we've got 13 languages already, equals 26 > overrides, and I expect this to only grow. Adding two overrides for > every language that we add is not ideal. > > So my question here is: is there a better way to solve this? Some ideas, > in my order of preference, I don't know what's best or possible from > your point of view though: > > 1) Remove the test altogether. If I do not mark DefaultChoice as > translatable, then it will not appear in the .po file template, so > what's the chance of someone translating it nonetheless? And if they > do, it will be ignored so no harm done. I'm wondering what the test > tries to accomplish. > > 2) If the test is actually needed, make sure it does not trigger if > DefaultChoice was marked as translatable. If it's marked as such, the > package maintainer intends for it to be translated. > > 3) Trigger the warning only once for a package. > > 4) Make the warning overridable categorically, i.e. I add > "select-with-translated-default-field mailman/site_languages" and all > those warnings will be overridden regardless of the last bit. Attached is a patch that checks source packages instead of binary packages. There are different advantages for this solution: * it can easily ignore Default: fields with brackets (i.e. when the maintainer obviously wants this field translated). These brackets are not included in the binary packages. * it catches the problem even if the package is not translated yet * it includes other types (not only "select" and "multiselect", it is common to see things such as "Default: true" in case of boolean templates marked as translatable). Cheers, -- Thomas Huriaux
diff -ur /usr/share/lintian/checks/debconf checks/debconf --- /usr/share/lintian/checks/debconf 2006-09-04 21:03:38.000000000 +0200 +++ checks/debconf 2006-09-26 15:01:06.000000000 +0200 @@ -215,10 +215,6 @@ # Tests on translations my ($mainfield, $lang) = split m/-/, $field, 2; if (defined $lang) { - if ($isselect and $mainfield eq 'default') { - tag "select-with-translated-default-field", - "$template->{template} $lang"; - } $languages{$lang}{$mainfield}=1; } unless ($template_fields{$mainfield}) { # Ignore language codes here diff -ur /usr/share/lintian/checks/debconf.desc checks/debconf.desc --- /usr/share/lintian/checks/debconf.desc 2006-09-04 21:03:38.000000000 +0200 +++ checks/debconf.desc 2006-09-26 14:58:24.000000000 +0200 @@ -87,11 +87,6 @@ is a duplicate of the short description. If you cannot provide a good extended description, it is better to leave it blank. -Tag: select-with-translated-default-field -Type: warning -Info: You do not need to translate `Default:' fields of `select' or - `multiselect' questions in templates. - Tag: partially-translated-question Type: warning Info: If you translate the `Choices:' fields in a template, you should diff -ur /usr/share/lintian/checks/po-debconf checks/po-debconf --- /usr/share/lintian/checks/po-debconf 2006-05-17 04:09:04.000000000 +0200 +++ checks/po-debconf 2006-09-26 14:58:24.000000000 +0200 @@ -38,6 +38,13 @@ $has_template = 1; if ($file =~ m/templates\.\w\w(_\w\w)?$/) { push (@lang_templates, $file); + } else { + open(PO, "< debfiles/$file") + or fail("Can't open debfiles/$file file."); + while (<PO>) { + tag "translated-default-field", "$file: $." + if (m/^_Default(Choice)?: [^[]*$/); + } } } } diff -ur /usr/share/lintian/checks/po-debconf.desc checks/po-debconf.desc --- /usr/share/lintian/checks/po-debconf.desc 2006-05-07 08:26:02.000000000 +0200 +++ checks/po-debconf.desc 2006-09-26 14:58:24.000000000 +0200 @@ -63,3 +63,14 @@ This can be ensured by running debconf-updatepo in the 'clean' target of <tt>debian/rules</tt>. PO files will then always be up-to-date when building the source package. + +Tag: translated-default-field +Type: warning +Info: You should not mark as translatable `Default:' fields, unless + explicitly needed (e.g. default country, default language, etc.). + If this Default field really should be translated, you should explain + translators how they should translate it by using brackets. + For example: + . + _Default: English[ Default language name, but not translated] +Ref: po-debconf(7)
Attachment:
signature.asc
Description: Digital signature