Bug 1421104 - [fr_FR, es_ES] [Admin Portal] Some numbers are displayed as 'NaN' on Dashboard tab.
Summary: [fr_FR, es_ES] [Admin Portal] Some numbers are displayed as 'NaN' on Dashboar...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-dashboard
Classification: oVirt
Component: Core
Version: 1.1.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ovirt-4.2.0
: 1.2.0
Assignee: Scott Dickerson
QA Contact: Pavel Novotny
URL:
Whiteboard:
Depends On:
Blocks: 1489152
TreeView+ depends on / blocked
 
Reported: 2017-02-10 10:58 UTC by Bhushan Barve
Modified: 2017-12-20 11:04 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, in some languages, some numbers on the dashboard were displayed as 'NaN'. With this bug fix, all numbers now render correctly.
Clone Of:
Environment:
Last Closed: 2017-12-20 11:04:52 UTC
oVirt Team: UX
rule-engine: ovirt-4.2+
pnovotny: testing_plan_complete-
rule-engine: planning_ack+
gshereme: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)
fr_FR numbers (55.75 KB, image/png)
2017-02-10 10:58 UTC, Bhushan Barve
no flags Details
screen: Dashboard - fixed number formatting (51.60 KB, image/png)
2017-12-15 18:28 UTC, Pavel Novotny
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 82239 0 master MERGED intl - Use rounding for numbers passed to message formats 2020-02-14 05:28:37 UTC

Description Bhushan Barve 2017-02-10 10:58:42 UTC
Created attachment 1249022 [details]
fr_FR numbers

Description of problem: For fr_FR and es_ES locales, some numbers are displayed as 'NaN' on the Dashboard tab.

For e.g. under Global Utilization - memory section, the string in English is displayed as 
21.4
Available
of 23.2 GiB

Whereas the corresponding string in fr_FR is displayed as - 
21,4
Disponible
parmi NaN GiB

This is observed with storage section as well. Please refer attached screenshot. This is applicable for es_ES locale as well. 


Version-Release number of selected component (if applicable):
4.1.0.3-0.1.el7

How reproducible:
always

Steps to Reproduce:
1.login with fr_FR or es_ES locale to admin portal.
2.go to dashboard tab.
3.observe the strings under memory or storage section under global utilization for available space/memory.

Actual results:
'21.4 Available of 23.2 GiB' is displayed as '21,4 Disponible parmi NaN GiB' for fr_FR locale.

Expected results:
Proper numbers should be displayed instead of NaN.

Additional info:
Not sure, but it might be because of the way in which numbers with decimals are written in fr_FR or es_ES locales - for e.g. 21,4 GiB instead of 21.4 GiB in en_US or other locales.

Comment 1 Oved Ourfali 2017-05-15 06:46:32 UTC
Scott, can you take a look?

Comment 2 Scott Dickerson 2017-09-22 23:06:39 UTC
This is being caused because the number is being formatted to a locale specific string (e.g. "12.3156" to "12,3") and then is given to a message format that expects a number value as one of the substitutions (e.g. "of {total, number} {unit}").  The message formatter can't convert "12,3" to the number 12.3 and it renders a NaN instead.

The solution is to either round the numbers as appropriate and then pass them as numbers to the message formatter or to update the message format to include rounding.  I'll investigate if the message formatter we use supports formatting numbers how we want.  If it can, then I can update all the message (and translations) or I can update the code so the numbers aren't formatted on the way in but get rounded first.

Comment 3 Scott Dickerson 2017-09-26 17:16:40 UTC
Code was changed to round numbers properly prior to being formatted in messages.  I don't see a point making translators worry about the decimal precision.

Comment 4 Scott Dickerson 2017-09-26 17:32:37 UTC
*** Bug 1489152 has been marked as a duplicate of this bug. ***

Comment 6 Pavel Novotny 2017-12-15 17:22:14 UTC
Verified in
ovirt-engine-4.2.0.2-0.1.el7.noarch
ovirt-engine-dashboard-1.2.0-1.el7ev.noarch

The number formatting now looks ok for all locales. I haven't found any 'NaN' on the Dashboard.
Checked on the Global Utilization cards, as well as in the Top Utilized Resources dialogs.
Screenshot of the fixed Dashboard (fr_FR locale) is attached.

Comment 7 Pavel Novotny 2017-12-15 18:28:50 UTC
Created attachment 1368611 [details]
screen: Dashboard - fixed number formatting

Comment 8 Sandro Bonazzola 2017-12-20 11:04:52 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

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


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