Viewing a translation page fails in unix2newlines

Bug #1681 reported by Gábor Hargitai
70
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Carlos Perelló Marín

Bug Description

Viewing a translation page fails with the following traceback:

  Module canonical.launchpad.browser.pomsgset, line 176,
in getTranslation
    return helpers.unix2windows_newlines(translation)
  Module
canonical.launchpad.helpers, line 835, in unix2windows_newlines
    raise
ValueError('\'%r\' is already converted' % text)
ValueError: 'u'Por favor, entre
com sua senha para executar:\r\n %s'' is already converted

Which suggests that unix2newlines is running on an already-converted string.

Some example pages which may fail (or that failed at least once):
https://launchpad.net/products/sympa/+series/main/+pots/sympa/hu/+translate
https://launchpad.net/distros/ubuntu/hoary/+sources/update-notifier/+pots/update-notifier/pt_BR/+translate

Error Reference: OOPS-A466 from bug 6101 which is a dupe of this one.

https://launchpad.net/distros/ubuntu/hoary/+source/gaim/+pots/gaim/es/+translate

Revision history for this message
Christian Reis (kiko) wrote :

    * Module zope.tales.tales, line 698, in evaluate
      /srv/launchpad.net/production/launchpad/lib/canonical/launchpad/templates/pofile-translate.pt
      Line 320, Column 24
      Expression: <PythonExpr (messageSet.getTranslation(index))>
         - Names:
            {'args': (),
             'context': <POFile at 0x2aa080d450>,
             'default': <object object at 0x2a955c01d0>,
             'loop': {},
             'nothing': None,
             'options': {},
             'repeat': {},
             'request': <zope.publisher.browser.BrowserRequest instance URL=https://launchpad.net/products/sympa/+series/main/+pots/sympa/hu/+translate>,
             'template': <zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at 0x2a9ecccad0>,
             'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object at 0x2aa18d9a10>,
             'view': <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /srv/launchpad.net/production/launchpad/lib/canonical/launchpad/templates/pofile-translate.pt object at 0x2aa17e2a90>,
             'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x2aa18d9150>}
    * Module zope.tales.pythonexpr, line 59, in __call__
      __traceback_info__: (messageSet.getTranslation(index))
    * Module <string>, line 0, in ?
    * Module canonical.launchpad.browser.pomsgset, line 176, in getTranslation
    * Module canonical.launchpad.helpers, line 829, in unix2windows_newlines
      raise ValueError('\'%r\' is already converted' % text)

ValueError: 'u'A levelez\xe9si lista kezel\u0151 nem tudta tov\xe1bb\xedtani \xd6nnek a levelet, mert nem tudta el\xe9rni a szem\xe9lyes tanus\xedtv\xe1ny\xe1t (e-mail: %1).\r\n'' is already converted

Revision history for this message
Po0ky (jan-buitendezone) wrote :

Same for the dutch language

Revision history for this message
Christian Reis (kiko) wrote :

Oddly enough, I can're reproduce these anymore. Can anyone reproduce?

Revision history for this message
Gábor Hargitai (higany) wrote :

I can't reproduce it too.

Revision history for this message
Christian Reis (kiko) wrote :

It still occurs, we just got a dupe reported. It's kind of hard to reproduce because I think the string order changes -- or something else transient happens.

Christian Reis (kiko)
description: updated
Changed in launchpad:
status: New → Accepted
description: updated
Changed in rosetta:
assignee: nobody → carlos
status: Confirmed → In Progress
Revision history for this message
Carlos Perelló Marín (carlos) wrote :

Ok, so the plan to fix this is:

All translation imports (using web or .po uploads) will be modified so:

- if the translation has '\r\n' but the msgid does not have it, we will remove the '\r' from the translation.
- if the translation has '\n' and the msgid has '\r\n' the translation will have too '\r\n'.
- if the msgid and the translation has '\r\n' nothing will be changed.

Also, when a new .pot is imported, if any msgid has a '\r' char we will warn the uploader because we think is better if the source strings has only '\n' chars as the translator does not have a way to easily see or understand it.

Revision history for this message
Carlos Perelló Marín (carlos) wrote :

This fix is already implemented and waiting for a review. If all things goes as it should, it will be applied next Tuesday in our production server.

Revision history for this message
Carlos Perelló Marín (carlos) wrote :

The fix is done. Will be installed in our servers soon.

Changed in rosetta:
status: In Progress → Fix Committed
Changed in rosetta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.