Messages with line break markers (\\) in the Checkbox test descriptions not correctly extracted for translation

Bug #514401 reported by Sergio Zanchetta on 2010-01-29
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Checkbox
High
Jeff Lane
Ubuntu Translations
High
Unassigned
checkbox (Ubuntu)
High
Jeff Lane

Bug Description

Binary package hint: checkbox

Description: Ubuntu lucid (development branch)
Release: 10.04

Description: Ubuntu 9.10
Release: 9.10

checkbox version > 0.8.5

There are several strings appearing in english although they are translated in the po.
This happens on strings having "\\" within, coming from a "\" character present in test source files.

The bug is present in the latest version of checkbox from ppa also (version 0.9):
https://launchpad.net/~cr3/+archive/ppa

Manually changing original string (msgid) in a po file (deleting \\) in the source, rebuilding and installing the new package make it looks correctly (but it's just a bad bad hack obviously ;-) )

This bug affects all not-english users.

Related branches

Changed in checkbox (Ubuntu):
importance: Undecided → High
David Planella (dpm) wrote :

I think the best thing to do would be to remove all \ from the original strings if possible. It is not just the fact that translations are not working at the moment, but these backslashes confuse translators.

Marc, what do you think, would this be possible in Lucid? Thanks!

Changed in ubuntu-translations:
status: New → Confirmed
importance: Undecided → High
Gabor Kelemen (kelemeng) wrote :

There are no more \\ characters, but intltool still does not retain line breaks, so strings stretching into multiple lines are not translated. Single line strings are translated correctly.

tags: added: lucid
summary: - Several strings appear in english although translated
+ [Lucid Beta1] Several strings appear in english although translated

This bug is still present in Lucid Beta 2.

summary: - [Lucid Beta1] Several strings appear in english although translated
+ [Lucid Beta2] Several strings appear in english although translated

El dg 11 de 04 de 2010 a les 16:40 +0000, en/na Sergio Zanchetta va
escriure:
> This bug is still present in Lucid Beta 2.
>
> ** Summary changed:
>
> - [Lucid Beta1] Several strings appear in english although translated
> + [Lucid Beta2] Several strings appear in english although translated
>

Sergio,

Thanks for helping with reporting, triaging and fixing translations
bugs.

Every time you change the description of the bug there is a lot of
unnecessary e-mail traffic: quite a lot of people are subscribed to
bugmail and receive the update.

Therefore, unless there is a justified need to correct the title, I'd
recommend not changing it. If the bug is still not fixed, it is not
necessary to mark to which milestone it applies.

Thanks!

Marc, has this been fixed in Maverick?

Changed in ubuntu-translations:
status: Confirmed → Triaged

A new checkbox template was imported yesterday.

Could someone perhaps test if this bug is still present by translating at least one of the problematic strings and checking out it is displayed correctly (either waiting for the next language pack or by installing an .mo file manually)?

Thanks!

summary: - [Lucid Beta2] Several strings appear in english although translated
+ Several strings appear in English although translated
David Planella (dpm) wrote :

Right, I've just tested this, and it's not fixed.

I've run 'LANGUAGE=es checkbox-gtk' (Spanish translation is complete), but several translations are still not being loaded. For example:

https://translations.launchpad.net/ubuntu/maverick/+source/checkbox/+pots/checkbox/es/+translate?batch=10&show=all&search=Fingerprint+login+verification+procedure

That particular one is present in the language pack, but it is not being loaded when running the fingerprint test.

Gabor Kelemen (kelemeng) wrote :

I got it: http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description

According to this, lines that begin with a space are expected to be part of a paragraph, and lines starting with two spaces are expected to be displayed verbatim - intltool-extract works consistently with this, so after changing a file to start description strings streching to multiple lines with two spaces, line breaks are preserved. Too bad, that translation still does not work: http://people.ubuntu.com/~kelemeng/pix/checkbox.png

Gabor Kelemen (kelemeng) wrote :

Just in case, here is a patch to do further testing/etc.

tags: added: patch
David Planella (dpm) on 2010-09-16
summary: - Several strings appear in English although translated
+ Translations are not loaded for the test descriptions in Checkbox

I take this opportunity, based from Gabor patch and a little modifications

see http://imagebin.org/128148

David Planella (dpm) wrote :

Any update on this?

Could any of the checkbox developers look at the merge proposal?

Thanks!

Jeff Lane (bladernr) wrote :

David, I merged Michael Terry's branch.

Changed in checkbox (Ubuntu):
status: New → Fix Released
assignee: nobody → Jeff Lane (bladernr)
Changed in checkbox:
status: New → Fix Released
assignee: nobody → Jeff Lane (bladernr)
importance: Undecided → High
David Planella (dpm) wrote :

Jeff, thanks a lot for that!

I see you've marked the bug as Fix Released, but it seems that according to comment #8, while the linked branch improves things (preserves line breaks in the extracted transaltions), it does not actually fix the bug.

Did you have the chance to test whether after merging mterry's branch translations are actually loaded? Otherwise I'd suggest reverting the status to New, Confirmed or Triaged.

Jeff Lane (bladernr) on 2011-03-17
Changed in checkbox:
status: Fix Released → Triaged
Jeff Lane (bladernr) wrote :

David, good call, thanks. I marked the upstream checkbox back to Triaged, but I can't change the Ubuntu Checkbox back :(

I poked at it briefly last night and didn't notice then, but on a second look this morning I'm assuming the issue is still there...

Looking at Spanish, the es.po file shows translated strings (using firewire for example):
#. description
#: ../tests/firewire.txt.in:3
msgid ""
"Firewire HDD verification procedure: 1.- Plug a Firewire HDD into the "
"computer 2.- A window should be opened asking which action should be "
"performed (open folder, photo manager, etc). 3.- Copy some files from the "
"internal/firewire HDD to the firewire/internal HDD"
msgstr ""
"Procedimiento de verificación de disco duro firewire: 1.- Conecte un disco "
"duro firewire al equipo 2.- Aparecerá una ventana preguntándole qué acción "
"desea tomar (abrir carpeta, gestor de fotos, etc.) 3.- Copie algunos "
"archivos del disco duro interno al firewire y viceversa."

but not all the strings are being picked up... :(

Jeff Lane (bladernr) wrote :

More info... after building checkbox from trunk after merging Michael's branch, the spanish po file looks like I mentioned above. I checked es.po and everything seemed to have a translation string.

Also, the locale files (/usr/share/locale/*/LC_MESSAGES/checkbox.mo seem to have the translated strings in them (at least es and de do).

So when running checkbox with the language set, as above (LANGUAGE=es checkbox-gtk) the windows and buttons are all translated, but the strings for the job descriptions, while existing in the locale message file are not being pulled in... :(

Sadly, I know very little about translations and localizing so I'm learning this as I go along.

Gabor Kelemen (kelemeng) wrote :

Jeff: don't worry, I can give a little more insight to the problem :)

Basically, you just committed my patch, which fixes one thing: extraction of strings. To see the effect of this, you would need to update the translation file, which you seem did not do. So, go to the po folder, and issue `intltool-update es`. This would give you an es.po file that looks like my hu.po on the screenshot in comment #8. So instead of "1 - ... 2 - ... 3 - ... " you should see
"1 - ...
2 - ...
3 - ..."
in the msgid field (also, don't forget to remove the "#, fuzzy" mark, otherwise the translation will be omitted from the .mo file when you build it).

After doing this, the problem should be solved - in theory. However, I could not see the translated text, so there must be an other bug too. Perhaps checkbox changes somehow the text, so when it looks for the translation, it does not look after the same strings that are in the po files - but this is just a guess.

Vish (vish) on 2011-03-18
Changed in checkbox (Ubuntu):
status: Fix Released → Triaged
David Planella (dpm) wrote :

I think the important thing to understand first is how the text for the string in all *.txt.in files are loaded at runtime.

They are rfc822deb files, and their strings are now correctly marked for _extraction_, so that at build time intltool extracts their translatable strings and puts them in the po/checkbox.pot file exposing them to translators.

I think the difference here with most of the translations we're used to deal with is that in this particular case marking a string to be translatable means that it will be extracted, but it does not mean that it will be passed to gettext at runtime to load its translation.

What I mean is:

1) In jobs/firewire.txt.in
_description:
 Firewire HDD verification procedure:
[...]

=> Here the leading underscore '_' tells intltool to extract the string, but it does not call gettext, so translations are not loaded at runtime.

2) Somewhere in a .py file in the code:

from gettext import gettext as _

_("This is a translatable string in the code")

=> Here wrapping the string with the gettext function tells intltool to extract the string and calls the gettext function. Hence translations are loaded at runtime.

So how can we call gettext giving it the text in the *.txt files as an argument in the first case?

Gabor Kelemen (kelemeng) wrote :

David: perhaps this file has something to do about it:

http://bazaar.launchpad.net/~checkbox-dev/checkbox/trunk/view/head:/checkbox/lib/template_i18n.py

But I don't really understand what's going on in here. :(

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package checkbox - 0.11.2

---------------
checkbox (0.11.2) natty; urgency=low

  New upstream release (LP: #736919):
  * Added version to dpkg dependency
  * Added multiarch support to install script (LP: #727411)
  * Fixed submitting data twice (LP: #531010)
  * Fixed job descriptions for checkbox-cli (LP: #221400)

  [Daniel Manrique]
  * Fixed strings in audio tests and updated pot file (LP: #691241)

  [Jochen Kemnade]
  * Fixed grammar in user-apps tests (LP: #642001)

  [Jeff Lane]
  * Added reboot instructions to suspend/hibernate tests (LP: #420493)
  * Made the firewire instructions make more sense (LP: #693068)

  [Michael Terry]
  * Fixed several strings appear in English although translated (LP: #514401)
    - jobs/fingerprint.txt.in
    - jobs/media.txt.in
    - jobs/monitor.txt.in
    - jobs/sleep.txt.in
    - jobs/firewire.txt.in
    - po/checkbox.pot
  * Fixed grammar (LP: #525454)
    + jobs/fingerprint.txt.in
 -- Marc Tardif <email address hidden> Thu, 17 Mar 2011 11:15:12 -0400

Changed in checkbox (Ubuntu):
status: Triaged → Fix Released
David Planella (dpm) wrote :

As the upload does not fix the original bug and it's best not to revert the status, I've changed the bug description to reflect what is actually being fixed with the upload and filed bug 740146 as a follow-up.

summary: - Translations are not loaded for the test descriptions in Checkbox
+ Messages with line break markers (\\) in the Checkbox test descriptions
+ not correctly extracted for translation
Changed in ubuntu-translations:
status: Triaged → Fix Released
Changed in checkbox:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers