Bug 888853

Summary: subscription-manager lists are poorly formated in foreign languages
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED CURRENTRELEASE QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: awood, jgalipea
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-07 22:23:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 863175    

Description John Sefler 2012-12-19 16:23:11 UTC
Description of problem:

msgids like the following are used in subscription-manager lists to format blocks of data:
msgid "Product ID:           \t%s"
msgid "Product Name:         \t%s"
msgid "Version:              \t%s"

The problem with this msgid is that the foreign language translators often neglect the white space in their translations and as a result we get ugly formatted output.  For example compare english and ml_IN:

[root@jsefler-6 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Red Hat Enterprise Linux Server
Product ID:           	69
Version:              	6.4
Arch:                 	x86_64
Status:               	Not Subscribed
Starts:               	
Ends:                 	

[root@jsefler-6 ~]# LANG=ml_IN.UTF-8 subscription-manager list --installed
+-------------------------------------------+
    ഇന്‍സ്റ്റോള്‍ ചെയ്ത പ്രൊഡക്ടിന്റെ അവസ്ഥ
+-------------------------------------------+
പ്രൊഡക്ടിന്റെ പേരു്: Red Hat Enterprise Linux Server
പ്രൊഡക്ട് ഐഡി: 69
പതിപ്പു്: 6.4
ആര്‍ക്ക്:                 	x86_64
അവസ്ഥ:               	അംഗമായിട്ടില്ല
ആരംഭം:               	
അവസാനം:    

^^^^^^^ Notice that the data does not appear columnar in ml_IN like it does in English.  There are two contributors to this ugliness..


Contributing Factor 1:  The translators need to stop stripping out the "\t" formatting:

[root@jsefler-6 ~]# pofilter --gnome -t tabs /usr/share/locale/ml/LC_MESSAGES/rhsm.po | grep msg -A1 -B1
processing 1 files...
[###########################################] 100%
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
--
# (pofilter) tabs: Different tabs
msgid "Product ID:           \t%s"
msgstr "പ്രൊഡക്ട് ഐഡി: %s"

# (pofilter) tabs: Different tabs
msgid "Product Name:         \t%s"
msgstr "പ്രൊഡക്ടിന്റെ പേരു്: %s"

# (pofilter) tabs: Different tabs
msgid "Version:              \t%s"
msgstr "പതിപ്പു്: %s"
[root@jsefler-6 ~]# 



Contributing Factor 2: We can avoid problem 1 in the source code by changing the formatting style for msgids of this type:
msgid "Product ID:           \t%s"
msgid "Product Name:         \t%s"
msgid "Version:              \t%s"
Stop using that ^ format and starting using string padding like this:
msgid "Product ID:"
msgid "Product Name:"
msgid "Version:"
String.format("%-22s", "Product ID:")+productIDValue;
               ^^^^^ In Java, this will left justify "Product ID:" within a 22 space character field. (Sorry - I don't know the python syntax for padding strings.)
Also note that you should use a max function on the field width to make sure the width is greater than the actual translated label.




Version-Release number of selected component (if applicable):
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.1.18-1.el6.x86_64
This problem has existed since the first version of subscription-manager.

Comment 1 John Sefler 2012-12-19 16:26:59 UTC
Use this bug to initiate a solution to Contributing Factor 2 discussed above.
Contributing Factor 1 is covered by other bugs that are assigned to the translators.

Comment 2 Bryan Kearney 2013-01-25 19:43:36 UTC
*** Bug 878656 has been marked as a duplicate of this bug. ***

Comment 3 John Sefler 2013-11-07 22:23:57 UTC
This has been fixed by other bugs, especially bug 985502