Skip to content

Commit

Permalink
status: translate unattached yes/no available column
Browse files Browse the repository at this point in the history
  • Loading branch information
orndorffgrant committed Oct 27, 2023
1 parent 919c28a commit e5447cb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
16 changes: 16 additions & 0 deletions features/i18n.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ Feature: Pro supports multiple languages
"""
Esta máquina NÃO está vinculada a uma assinatura do Ubuntu Pro.
"""
When I run shell command `LANGUAGE=pt_BR.UTF-8 pro status --all` as non-root
Then stdout contains substring:
"""
sim
"""
Then stdout contains substring:
"""
não
"""
When I run `apt update` with sudo
And I apt install `jq`
And I run shell command `LANGUAGE=pt_BR.UTF-8 pro status --format json | jq .services[0].available` as non-root
Then I will see the following on stdout:
"""
"yes"
"""
When I run `apt-get remove -y ubuntu-pro-client-l10n` with sudo
When I run shell command `LANGUAGE=pt_BR.UTF-8 pro security-status` as non-root
Then stdout contains substring:
Expand Down
7 changes: 5 additions & 2 deletions uaclient/messages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class TxtColor:
ENDC = "\033[0m"


STANDALONE_YES = t.gettext("yes")
STANDALONE_NO = t.gettext("no")

OKGREEN_CHECK = TxtColor.OKGREEN + "✔" + TxtColor.ENDC
FAIL_X = TxtColor.FAIL + "✘" + TxtColor.ENDC
BLUE_INFO = TxtColor.INFOBLUE + "[info]" + TxtColor.ENDC
Expand Down Expand Up @@ -808,8 +811,8 @@ class TxtColor:
STATUS_NOTICES = t.gettext("NOTICES")
STATUS_FEATURES = t.gettext("FEATURES")

STATUS_ENTITLED_ENTITLED = t.gettext("yes")
STATUS_ENTITLED_UNENTITLED = t.gettext("no")
STATUS_ENTITLED_ENTITLED = STANDALONE_YES
STATUS_ENTITLED_UNENTITLED = STANDALONE_NO
STATUS_STATUS_ENABLED = t.gettext("enabled")
STATUS_STATUS_DISABLED = t.gettext("disabled")
STATUS_STATUS_INAPPLICABLE = t.gettext("n/a")
Expand Down
7 changes: 6 additions & 1 deletion uaclient/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,15 @@ def format_tabular(status: Dict[str, Any], show_all: bool = False) -> str:
if descr_override
else service.get("description", "")
)
available = (
messages.STANDALONE_YES
if service.get("available") == "yes"
else messages.STANDALONE_NO
)
content.append(
STATUS_UNATTACHED_TMPL.format(
name=service.get("name", ""),
available=service.get("available", ""),
available=available,
description=description,
)
)
Expand Down

0 comments on commit e5447cb

Please sign in to comment.