Bug 2024202
| Summary: | RHV Dashboard does not show memory and storage details properly when using Spanish language. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Virtualization Manager | Reporter: | Abhishekh Patil <abpatil> |
| Component: | ovirt-engine-ui-extensions | Assignee: | rszwajko |
| Status: | CLOSED ERRATA | QA Contact: | Ivana Saranova <isaranov> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.4.8 | CC: | emarcus, gdeolive, jspanko, lsurette, mavital, mhicks, sdickers, sgratch, srevivo, tnisan |
| Target Milestone: | ovirt-4.5.0 | ||
| Target Release: | 4.5.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| 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.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-05-26 16:23:22 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | UX | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Abhishekh Patil
2021-11-17 14:51:14 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',
},
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
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 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 Due to QE capacity, we are not going to cover this issue in our automation |