Bug 1663429

Summary: [ALL LANG][RHSM CLI] Unlocalized message in usage module.
Product: Red Hat Enterprise Linux 8 Reporter: Lijun Li <lijli>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: candlepin-bugs, csnyder, jhnidek, jsefler, khowell, ljanda, lmiksik, qe-i18n-bugs, redakkan
Target Milestone: rcKeywords: EasyFix, i18n, Reopened, Triaged
Target Release: 8.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: subscription-manager-1.28.16-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1805620 (view as bug list) Environment:
Last Closed: 2021-11-09 19:37:12 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: 1682763    
Bug Blocks: 1805620    

Description Lijun Li 2019-01-04 09:52:43 UTC
Description of problem:
[ALL LANG][RHSM CLI] Unlocalized message in usage module.

Version-Release number of selected component (if applicable):
subscription-manager-1.23.8-11.el8.x86_64.rpm

How reproducible:
100%

Steps to Reproduce:
1. Install latest rhel8 workstation build.
2. Run rhsm cli from terminal.

Actual results:
# subscription-manager usage -h
使用:subscription-manager usage [选项]

这个系统的管理使用设置

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --set=SET             Set usage of system purpose
  --unset               Unset usage of system purpose
                        ^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.
[root@localhost ~]# subscription-manager usage --set "Development/Test"
usage set to "Development/Test".
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized message.
[root@localhost ~]# subscription-manager usage
Usage not set.
^^^^^^^^^^^^^^^Unlocalized message.

Expected results:
It should be localized.

Additional info:

Comment 3 Lijun Li 2019-07-01 03:42:52 UTC
This is also reproduced on latest rhel7.7 snapshot build.

Comment 4 Lijun Li 2019-10-15 07:27:53 UTC
Reproduced on latest rhel8.1 build.
# subscription-manager usage -h
使用:subscription-manager usage [选项]

Manage usage setting for this system
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.

选项:

  --set=SET             Set usage of system purpose
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.
  --unset               Unset usage of system purpose
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.
# subscription-manager usage --set "Test"
usage set to "Test".
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.
# subscription-manager usage --unset
usage unset.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.
# subscription-manager usage
Usage not set.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unlocalized messages.

Comment 10 John Sefler 2020-08-17 19:24:20 UTC
Testing Version...

[root@hpe-dl380pgen8-02-vm-15 ~]# rpm -q subscription-manager
subscription-manager-1.27.13-1.el8.x86_64


[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager usage -h
使用:subscription-manager usage [选项]

管理此系统的使用设置                                        <====== PASSED

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         使用 set 和 unset 定义此字段的值
  --set=SET             set usage of system purpose      <====== FAILEDQA - CHANGED STRING (Set => set)
  --unset               unset usage of system purpose    <====== FAILEDQA - CHANGED STRING (Unset => unset)
  --show                how this system's current usage  <====== FAILEDQA - NEW UNTRANSLATED STRING
  --list                list all usage available         <====== FAILEDQA - NEW UNTRANSLATED STRING

[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager usage --set "Test"
Warning: Provided value "Test" is not included in the list of valid values    <====== FAILEDQA - NEW UNTRANSLATED STRING
 - Production
usage 设置为 "Test"。                                     <====== PASSED

[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager usage --unset
usage 取消设置。                                          <====== PASSED

[root@hpe-dl380pgen8-02-vm-15 ~]# LANG=zh_CN.utf-8 subscription-manager usage
Usage 未设置。                                            <====== PASSED


Moving back to NEW/FailedQA

Comment 11 John Sefler 2020-08-17 20:06:12 UTC
Also note the typo in the msgstr...

[root@hpe-dl38[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager usage -h | grep "this system's current"
  --show                how this system's current usage
                        ^^^
                        FAILEDQA - EXPECTED "show"

Comment 12 Lijun Li 2020-09-07 06:34:38 UTC
Reproduced on latest rhel8.3 build.

[root@localhost ~]# rpm -q subscription-manager
subscription-manager-1.27.15-1.el8.x86_64

[root@localhost ~]# subscription-manager usage -h
使用:8 usage [选项]

管理此系统的使用设置

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         使用 set 和 unset 定义此字段的值
  --set=SET             set usage of system purpose
  --unset               unset usage of system purpose
  --show                how this system's current usage
  --list                list all usage available

Comment 13 Lijun Li 2020-09-07 09:36:25 UTC
[root@localhost ~]# subscription-manager usage -h
使用:8 usage [选项]

管理此系统的使用设置

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         使用 set 和 unset 定义此字段的值
  --set=SET             set usage of system purpose      <====== FAILEDQA
  --unset               unset usage of system purpose      <====== FAILEDQA
  --show                how this system's current usage      <====== FAILEDQA & Typo how->show
  --list                list all usage available
[root@localhost ~]# subscription-manager usage --set "Test"
Warning: Provided value "Test" is not included in the list of valid values      <====== FAILEDQA
 - Production
usage 设置为 "Test"。
[root@localhost ~]# subscription-manager usage --list
+-------------------------------------------+
               Available usage                    <====== FAILEDQA
+-------------------------------------------+
 - Production
[root@localhost ~]# subscription-manager usage --show
Current Usage: Test                            <====== FAILEDQA
[root@localhost ~]# subscription-manager usage
Current Usage: Test
[root@localhost ~]# rpm -q subscription-manager
subscription-manager-1.27.15-1.el8.x86_64

Comment 19 RHEL Program Management 2021-02-01 07:31:40 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 20 John Sefler 2021-04-07 20:13:46 UTC
[root@hpe-dl380pgen8-02-vm-2 ~]# rpm -q subscription-manager
subscription-manager-1.28.13-2.el8.x86_64
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager usage
Usage 未设置。
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager usage --set "Test"
警告:所提供的值 "Test" 没有包括在有效值列表中
 - Production
usage 设置为 "Test"。
[root@hpe-dl380pgen8-02-vm-2 ~]# 
[root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager usage
Current Usage: Test        <================ FAILEDQA
[root@hpe-dl380pgen8-02-vm-2 ~]# 


[root@hpe-dl380pgen8-02-vm-2 ~]# msgunfmt --no-wrap  /usr/share/locale/zh_CN/LC_MESSAGES/rhsm.mo | grep -A1 "Current "
msgid "Current service level: %s"
msgstr "当前服务等级:%s"
--
msgid "Current {name}: {val}"
msgstr "当前 {name}: {val}"    <================ EXPECTED THIS TRANSLATION TO BE USED
--
msgid "Installed Product Current Status:"
msgstr "已安装的产品的当前状态:"

Comment 21 Pino Toscano 2021-04-08 06:27:51 UTC
(In reply to John Sefler from comment #20)
> [root@hpe-dl380pgen8-02-vm-2 ~]# LANG=zh_CN.utf-8 subscription-manager usage
> Current Usage: Test        <================ FAILEDQA
> 
> [root@hpe-dl380pgen8-02-vm-2 ~]# msgunfmt --no-wrap /usr/share/locale/zh_CN/LC_MESSAGES/rhsm.mo | grep -A1 "Current "
> msgid "Current {name}: {val}"
> msgstr "当前 {name}: {val}"    <================ EXPECTED THIS TRANSLATION TO BE USED

Indeed, I can confirm this. The string is properly extracted and translated in some languages, however it is not translated properly at runtime due to a logic error:

            print(_("Current {name}: {val}".format(name=self.name.capitalize(),
                                                   val=values)))

(i.e. format() is applied on the English string, rather than the translated string.)

Thanks for testing, I'm reopening this bug and fixing this for 8.5.

Comment 23 Shwetha Kallesh 2021-05-04 11:54:42 UTC
Pre-verification comments:

[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.11-1
subscription management rules: 5.41
subscription-manager: 1.28.16-1.el8


[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage -h
使用:subscription-manager usage [选项]

这个系统的管理使用设置

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         使用设置和取消来定义该字段的值
  --set=SET             设置系统目的 usage
  --unset               取消设置系统目的 usage
  --show                显示本系统目前的 usage
  --list                列出所有可用的 usage


[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage --unset
usage 取消设置。

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage
Usage 未设置。

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage --show
Usage 未设置。

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage --set "Production"
usage 设置为 "Production"。

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage --show
当前 Usage: Test

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage
当前 Usage: Test



The following failing case of unlocalised warning message is tracked by the bug https://bugzilla.redhat.com/show_bug.cgi?id=1956764

[root@ibm-x3650m4-01-vm-14 ~]# LANG=zh_CN.utf-8 subscription-manager usage --set "Test"
Warning: Provided value "Test" is not included in the list of valid values
 - Production
 - Development
usage 设置为 "Test"。

Comment 26 Shwetha Kallesh 2021-05-20 05:52:05 UTC
Verification comments:
[root@kvm-02-guest25 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.11-1
subscription management rules: 5.41
subscription-manager: 1.28.16-1.el8


[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager usage -h
使用:subscription-manager usage [选项]

这个系统的管理使用设置

选项:
  -h, --help            显示此帮助信息并退出
  --proxy=PROXY_URL     代理服务器 URL 的格式为 proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        使用基本验证的 HTTP 代理服务器的用户
  --proxypassword=PROXY_PASSWORD
                        使用基本验证的 HTTP 代理服务器的密码
  --noproxy=NO_PROXY    跳过 HTTP 代理的主机后缀
  --username=USERNAME   在服务器中进行验证时使用的用户名
  --password=PASSWORD   在服务器中进行验证时使用的密码
  --token=TOKEN         在服务器中进行验证时使用的令牌
  --org=ORG_KEY         使用设置和取消来定义该字段的值
  --set=SET             设置系统目的 usage
  --unset               取消设置系统目的 usage
  --show                显示本系统目前的 usage
  --list                列出所有可用的 usage

[root@kvm-02-guest25 ~]#  LANG=zh_CN.utf-8 subscription-manager usage --unset
usage 取消设置。

[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager usage
Usage 未设置。

[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager usage --show
Usage 未设置。

[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager usage --set "Production"
usage 设置为 "Production"。

[root@kvm-02-guest25 ~]#  LANG=zh_CN.utf-8 subscription-manager usage --show
当前 Usage: Production

[root@kvm-02-guest25 ~]#  LANG=zh_CN.utf-8 subscription-manager usage
当前 Usage: Production


The following failing case of unlocalised warning message is tracked by the bug https://bugzilla.redhat.com/show_bug.cgi?id=1956764

[root@kvm-02-guest25 ~]# LANG=zh_CN.utf-8 subscription-manager usage --set "Test"
Warning: Provided value "Test" is not included in the list of valid values
 - Production
 - Development
usage 设置为 "Test"。

Comment 29 errata-xmlrpc 2021-11-09 19:37:12 UTC
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 (subscription-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2021:4390