New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in Swedish translation when displaying negative or zero values #18802
Comments
Hi @melker |
@sgiehl do you know how easy it is to fix this one? |
Maybe it's enough to fetch unformatted data for the sparklines and format them only for the display values. Or have unformatted data as metadata like we have for totals. Would need to have a look at that to say more |
I'd say the main problem is the weird translation. It should be the same signs as in the English version, at least in Swedish. (Other languages may have other signs.) |
@melker we are using the "official" data from Unicode CLDR: See https://raw.githubusercontent.com/unicode-org/cldr-json/39.0.0/cldr-json/cldr-numbers-full/main/sv/numbers.json |
@sgiehl not really.... It says: and on the page (my screenshot) you have: (reservation if I enter the wrong dash-sybol) |
@melker That minus sign differs from the english one. Even though it's not really good visible in some fonts.
And the reason that you see a plus and minus sign is something that happens in the code. Normally numbers don't have a plus sign in front. So we are adding one if the number is not negative. But the check for negative numbers fails in that case, as it already uses the formatted number, which uses another minus sign... |
That look bit weird to my the the English uses the hyphen-minus and not the formal minus character while the Swedish version uses the formal minus character... well I and not a person really into those things... but still It seems weird to me. Now moving forward instead... So you need to make the pos/neg check locale aware. How about the zeros? How come they get the same treatment as negative values? (I don't see what is used on the Unicode CLDR) |
Exactly. For the zero value that is a similar problem. The formatted percent value contains a non breaking space, which might also break the numeric detection. As noted somewhere above, we need to do such comparisons with unformatted numbers to fix all those issues. |
@sgiehl if there is a different sign, does that mean we can fix that one easily? At least for some languages by putting in the translated |
@tsteur yes that might work. Even though it would be more a workaround than a proper fix. |
@tsteur I have quickly set up a draft, which should fully fix it (at least for comparison). It adds an additional column for the comparison metrics, that indicates the trend. As this is done prior to formatting the number, this should work for all languages. |
@sgiehl I'll put the issue for now in 4.10 as it's quite a big change and adds heaps more information to the API output etc. If any possible, we should check if there's a smaller change that fixes this issue as well for Swedish maybe like in https://github.com/matomo-org/matomo/pull/18832/files#diff-9e27247dd682afe6f5fbc3c43bc37873fe2b5583a69ce15d233edfea3377aa3aR4 checking if the value contains the minusSign or translated minus sign for example. Then we could fix it sooner without needing to add so much information to the API and it would work in most countries. |
If the additional api output is a problem, we can simply remove it by default and only add it for internal requests when needed |
Not having the additional API output makes it better. I've moved this for now into 4.10 as the PR is a bigger review and quite complex and we have other more important issues in comparison. If there's an easy solution to it, then happy to put it in an earlier milestone. |
Posting two screenshots:
Displayed in English (Correct)
Displayed in Swedish (with some highlighted areas by me)
Bugs in Swedish version:
The text was updated successfully, but these errors were encountered: