Bug 2024202 - RHV Dashboard does not show memory and storage details properly when using Spanish language.
Summary: RHV Dashboard does not show memory and storage details properly when using Sp...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-ui-extensions
Version: 4.4.8
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.5.0
: 4.5.0
Assignee: rszwajko
QA Contact: Ivana Saranova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-17 14:51 UTC by Abhishekh Patil
Modified: 2024-12-20 21:36 UTC (History)
10 users (show)

Fixed In Version: ovirt-engine-ui-extensions-1.3.2-1
Doc Type: Bug Fix
Doc Text:
Previously, the formatting of parameters passed to translated messages on ui-extensions dialogs (not just in the Red Hat Virtualization dashboard) was handled in 2 different layers: code and translations. That caused invalid formatting for a number of language. In this release, the formatting of translated messages parameters on ui-extensions is done only on one layer, the translation layer (formatting done on code layer is removed). As a result, translation strings on ui-extensions dialogs are now displayed properly for all languages.
Clone Of:
Environment:
Last Closed: 2022-05-26 16:23:22 UTC
oVirt Team: UX
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github oVirt ovirt-engine-ui-extensions pull 43 0 None open Migrate messages to ICU number skeletons 2022-03-14 18:59:03 UTC
Red Hat Issue Tracker RHV-44046 0 None None None 2021-11-17 14:51:29 UTC
Red Hat Knowledge Base (Solution) 6724921 0 None None None 2022-02-11 12:25:13 UTC
Red Hat Product Errata RHSA-2022:4711 0 None None None 2022-05-26 16:23:52 UTC

Description Abhishekh Patil 2021-11-17 14:51:14 UTC
Description of problem:

RHV Dashboard does not show memory and storage details properly when using Spanish language. 

Version-Release number of selected component (if applicable):

RHV-4.4.8

How reproducible:
100%

Steps to Reproduce:
1. Change language for RHV web UI to Spanish.
2. Login to RHV administration portal and review the dashboard.


Actual results:

RHV Dashboard does not show memory and storage details properly when using Spanish language. 

Expected results:

RHV Dashboard should show memory and storage details properly when using any language.

Comment 5 rszwajko 2022-01-25 16:43:26 UTC
The problem is caused by too restrictive type checking - translation function expects a number but receives a string.
Example:
input(number): 100
formatted (string) : "100,0" 
Note that in English locale the number is formatted to "100.0" which allows automatic type conversion to number.

Problem can be solved by removing the type from message template. Unfortunately this invalidates the translation.

diff --git a/src/intl/messages.js b/src/intl/messages.js
index ffe3814..6c1b0e7 100644
--- a/src/intl/messages.js
+++ b/src/intl/messages.js
@@ -270,7 +270,7 @@ const messageDescriptors = {
 
   dashboardUtilizationCardAvailableOfUnit: {
     id: 'dashboard.utilizationCardAvailableOfUnit',
-    defaultMessage: 'of {total, number} {unit}',
+    defaultMessage: 'of {total} {unit}',
     description: 'part of utilization card\'s summary',
   },

Comment 7 rszwajko 2022-01-27 10:24:54 UTC
Note that this bug was possible because formatting is handled in 2 different layers: code and translations.
In order to prevent bugs due to type-aware messages we could switch to one approach only:
1. remove typing from messages and do the formatting in the code - this works well for complex cases but adds unnecessary overhead in simple cases
2. move all formatting to the translation layer - number skeleton [1] [2] syntax seems to cover all our cases(i.e. check diff below) and handles simple cases automatically. 


diff --git a/src/intl/translations.json b/src/intl/translations.json
index 4c91a31..e21544d 100644
--- a/src/intl/translations.json
+++ b/src/intl/translations.json
@@ -287,7 +287,7 @@
     "dashboard.utilizationCardAmountAvailableTooltip": "{percent} disponible",
     "dashboard.utilizationCardAmountUsedTooltip": "{percent} utilizado",
     "dashboard.utilizationCardAvailableOfPercent": "de {percent}",
-    "dashboard.utilizationCardAvailableOfUnit": "de {total, number} {unit}",
+    "dashboard.utilizationCardAvailableOfUnit": "de {total, number, ::.0} {unit}",
     "dashboard.utilizationCardCpuDialogTitle": "Recursos más utilizados (CPU)",
     "dashboard.utilizationCardDialogEmptyHostList": "Actualmente no hay hosts utilizados.",
     "dashboard.utilizationCardDialogEmptyStorageList": "Actualmente no hay dominios utilizados.",


[1] https://formatjs.io/docs/intl-messageformat/#number-skeleton
[2] https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision

Comment 14 Ivana Saranova 2022-04-19 11:40:26 UTC
Steps:
1. Change language for RHV web UI to Spanish.
2. Login to RHV administration portal and review the dashboard.

Verified in:
ovirt-engine-ui-extensions-1.3.2-1.el8ev.noarch
ovirt-engine-4.5.0.2-0.7.el8ev.noarch

Comment 19 errata-xmlrpc 2022-05-26 16:23:22 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 (Moderate: RHV Manager (ovirt-engine) [ovirt-4.5.0] security 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/RHSA-2022:4711

Comment 20 meital avital 2022-08-07 13:31:54 UTC
Due to QE capacity, we are not going to cover this issue in our automation


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