Re: Another raw idea for lintian check: variable substitution in debconf templates
Christian Perrier <bubulle@debian.org> writes:
> Yet another idea popping up in my mind. I'm in a lintian mood today..:)
Yay! :)
> Some debconf templates use variable substitution (along with debconf's
> SUBST command) to incorporate context-variable text in debconf
> templates.
>
> Description: Do you want to erase disk ${DISK}?
> Blah blah blah
>
> Translators MUST keep these variables unchanged in their translation
> and a very common mistake is translating them. French example:
>
> "Voulez-vous effacer le disque ${DISQUE}?"
>
> The result will be the variable popping up untranslated which is very
> disturbing and confusing for users (particularly in that case!).
>
> In D-I "spellchecker", we added such check for "bad variable
> substitution" and it catched many such errors.
Sure, that sounds like a good idea to me. Should we trigger on anything
in a lintian template that looks like ${DISK}? Would $DISK also be valid,
or are the curly braces required?
> I'm sorry for not being technically able to provide the appropriate
> patch to lintian for this but that could deserve some attention.
I assume that something like the following pseudocode would work:
foreach pofile in debian/po/*.po
foreach msgid, msgstr in pofile
vars_needed = find_variables(msgid)
vars_found = find_variables(msgstr)
if (not empty(msgstr) and vars_needed != vars_found)
tag 'variable-mismatch-in-translation', pofile, line
end
end
end
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: