Bug 820743 - some multiline strings extracted into string catalog incorrectly
some multiline strings extracted into string catalog incorrectly
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Adrian Likins
Entitlement Bugs
: Translation
Depends On:
Blocks: 738066 832111
  Show dependency treegraph
 
Reported: 2012-05-10 16:35 EDT by Adrian Likins
Modified: 2012-06-20 08:57 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 832111 (view as bug list)
Environment:
Last Closed: 2012-06-20 08:57:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adrian Likins 2012-05-10 16:35:50 EDT
Several strings were constructed with the format"

blah = _("something first line blah" +
         "this is another line")

Unfortunately, the string extraction tool (xgettext) doesn't understand
this formatting, and only extracts the first line of the msg for
the string catalog. 

So, the strings are incorrect in the string catalog, and only the
first line ever get's translated. 

Worse, at runtime, the "" + "" does get evaluated, so the string
gettext ask's for translations of is the first msg, which doesn't
not exist in the strings file. So, it show's up as the entire
string being untranslated.

We've got a couple of cases where we can truncate after the
first line, and use a workable firstline of the message, that
is translated, and will match for the translations. 

We also have some cases where it doesn't really make any sense
that way. Not sure the best approach for that is. A untranslated
full msg, or a translated partial msg. 


src/subscription_manager/managercli.py
632:            systemExit(-1, _("ERROR: The service-level command is not supported by " + \
638:        not_supported = _("ERROR: The service-level command is not supported by " + \
1138:                        systemExit(-1, _("ERROR: The --servicelevel option is not " + \
                                         "supported by the server. Did not perform " + \
                                         "autosubscribe."))
1221:                            print _("This machine has been unsubscribed from subscription " +
                                       "with serial number %s" % (self.options.serial))

src/subscription_manager/gui/importsub.py
85:            errorWindow(_("An error occurred while importing the certificate. " +
Comment 2 Adrian Likins 2012-05-11 10:26:18 EDT
commit 2678039648eca87fc904d507910cdc412c085cea
Author: Adrian Likins <alikins@redhat.com>
Date:   Fri May 11 10:18:16 2012 -0400

    820743: fix some merge errors from fix for 820743

commit f4ddefd5989760d4b62a754d850c60582012b20f
Author: Adrian Likins <alikins@redhat.com>
Date:   Thu May 10 16:15:36 2012 -0400

    820743: some multiline strings extracted into string catalog incorrectly
    
    So truncate these cases so we get at least a partial match.

in 0.99.18 or newer
Comment 6 John Sefler 2012-05-22 10:31:26 EDT
My strategy to verify this bug is to determine exactly what msgids in the source code are affected.  To do this, I'll git show the commit hashes in comment 2 to determine the affected msgids and then go to the translation files and make sure there is a translation for them...

[jsefler@jseflerT5400 subscription-manager]$ git branch
* RHEL6.3
  master
[jsefler@jseflerT5400 subscription-manager]$ git show f4ddefd5989760d4b62a754d850c60582012b20f | grep ^[+-]
--- a/src/subscription_manager/gui/importsub.py
+++ b/src/subscription_manager/gui/importsub.py
-            errorWindow(_("An error occurred while importing the certificate. " +
-                          "Please check log file for more information."),
+            errorWindow(_("An error occurred while importing the certificate. "),
--- a/src/subscription_manager/managercli.py
+++ b/src/subscription_manager/managercli.py
-                systemExit(-1, _("ERROR: The --servicelevel option is not supported " + \
-                                 "by the server. Did not perform autosubscribe."))
+                systemExit(-1, _("ERROR: The --servicelevel option is not supported ")
-                    print(_("An error occurred while importing the certificate. " +
-                                  "Please check log file for more information."))
+                    print(_("An error occurred while importing the certificate. ")
[jsefler@jseflerT5400 subscription-manager]$ 

[jsefler@jseflerT5400 subscription-manager]$ git show 2678039648eca87fc904d507910cdc412c085cea | grep ^[+-]
--- a/src/subscription_manager/managercli.py
+++ b/src/subscription_manager/managercli.py
-                systemExit(-1, _("ERROR: The --servicelevel option is not supported ")
+                systemExit(-1, _("ERROR: The --servicelevel option is not supported "))
-                    print(_("An error occurred while importing the certificate. ")
+                    print(_("An error occurred while importing the certificate. "))


Now i know that the original msgids that xgettext was not extracting completely have been modified to be:

"An error occurred while importing the certificate. "
"ERROR: The --servicelevel option is not supported "

Let's spotcheck a few translation files and assert these msgids have been translated...


[root@qe-blade-09 ~]# rpm -ql subscription-manager | grep rhsm.mo/usr/share/locale/as/LC_MESSAGES/rhsm.mo
/usr/share/locale/bn/LC_MESSAGES/rhsm.mo
/usr/share/locale/de/LC_MESSAGES/rhsm.mo
/usr/share/locale/es/LC_MESSAGES/rhsm.mo
/usr/share/locale/fr/LC_MESSAGES/rhsm.mo
/usr/share/locale/gu/LC_MESSAGES/rhsm.mo
/usr/share/locale/hi/LC_MESSAGES/rhsm.mo
/usr/share/locale/it/LC_MESSAGES/rhsm.mo
/usr/share/locale/ja/LC_MESSAGES/rhsm.mo
/usr/share/locale/kn/LC_MESSAGES/rhsm.mo
/usr/share/locale/ko/LC_MESSAGES/rhsm.mo
/usr/share/locale/ml/LC_MESSAGES/rhsm.mo
/usr/share/locale/mr/LC_MESSAGES/rhsm.mo
/usr/share/locale/or/LC_MESSAGES/rhsm.mo
/usr/share/locale/pa/LC_MESSAGES/rhsm.mo
/usr/share/locale/pt/LC_MESSAGES/rhsm.mo
/usr/share/locale/pt_BR/LC_MESSAGES/rhsm.mo
/usr/share/locale/ru/LC_MESSAGES/rhsm.mo
/usr/share/locale/ta/LC_MESSAGES/rhsm.mo
/usr/share/locale/te/LC_MESSAGES/rhsm.mo
/usr/share/locale/zh_CN/LC_MESSAGES/rhsm.mo
/usr/share/locale/zh_TW/LC_MESSAGES/rhsm.mo
[root@qe-blade-09 ~]# 

[root@qe-blade-09 ~]# msgunfmt /usr/share/locale/zh_TW/LC_MESSAGES/rhsm.mo | grep "An error occurred while importing the certificate. " -A1
msgid "An error occurred while importing the certificate. "
msgstr "匯入認證時發生錯誤。"
[root@qe-blade-09 ~]# msgunfmt /usr/share/locale/fr/LC_MESSAGES/rhsm.mo | grep "An error occurred while importing the certificate. " -A1
msgid "An error occurred while importing the certificate. "
msgstr "Une erreur s'est produite lors de l'importation du certificat."
[root@qe-blade-09 ~]# 

^^^ VERIFIED: The simplified msgid "An error occurred while importing the certificate. " appears translated.


[root@qe-blade-09 ~]# msgunfmt /usr/share/locale/te/LC_MESSAGES/rhsm.mo | grep "ERROR: The --servicelevel option is not supported " -A1
msgid "ERROR: The --servicelevel option is not supported "
msgstr "దోషం: --servicelevel ఐచ్చికం తోడ్పాటు నిచ్చుటలేదు"
[root@qe-blade-09 ~]# msgunfmt /usr/share/locale/it/LC_MESSAGES/rhsm.mo | grep "ERROR: The --servicelevel option is not supported " -A1
msgid "ERROR: The --servicelevel option is not supported "
msgstr "ERRORE: L'opzione --servicelevel non è supportata"
[root@qe-blade-09 ~]# 

^^^ VERIFIED: The simplified msgid "ERROR: The --servicelevel option is not supported " appears translated.

Moving status to VERIFIED
[root@qe-blade-09 ~]# rpm -q subscription-manager
subscription-manager-0.99.18-1.el6.x86_64

Note... As indicated in comment 0, these fixes only help the few strings were the partial msgid conveys a complete thought.  For other cases that were not fixed, an untranslated full msg will be displayed to the user.  This should get fixed in future releases of subscription-manager by enforcing a coding style that xgettext does not fail to extract.
Comment 8 errata-xmlrpc 2012-06-20 08:57:45 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0804.html

Note You need to log in before you can comment on or make changes to this bug.