Skip to content
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

Closed
melker opened this issue Feb 16, 2022 · 15 comments · Fixed by #18832
Closed

Bug in Swedish translation when displaying negative or zero values #18802

melker opened this issue Feb 16, 2022 · 15 comments · Fixed by #18832
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: i18n For issues around internationalisation and localisation.
Milestone

Comments

@melker
Copy link

melker commented Feb 16, 2022

Posting two screenshots:

Displayed in English (Correct)
matomo-bug-en

Displayed in Swedish (with some highlighted areas by me)
matomo-bug-sv

Bugs in Swedish version:

  • Negative values should be red
  • Negative values should have "-" (minus) not "+-" (plus and minus)
  • Zero-value should be "grey-ish" just as in the English version.
@sgiehl
Copy link
Member

sgiehl commented Feb 16, 2022

Hi @melker
Thanks for creating the issue. I was able to reproduce it locally. Guess that is due to the fact, that in Swedish it doesn't use a "english" minus sign and such can't detect that the number is lower 0. Guess this might happen for other languages as well.

@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. c: i18n For issues around internationalisation and localisation. labels Feb 16, 2022
@tsteur
Copy link
Member

tsteur commented Feb 16, 2022

@sgiehl do you know how easy it is to fix this one?

@sgiehl
Copy link
Member

sgiehl commented Feb 16, 2022

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

@melker
Copy link
Author

melker commented Feb 18, 2022

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.)

@sgiehl
Copy link
Member

sgiehl commented Feb 18, 2022

@melker
Copy link
Author

melker commented Feb 18, 2022

@sgiehl not really....

It says:
"minusSign": "−",

and on the page (my screenshot) you have:
"+-" (both plus and munis)

(reservation if I enter the wrong dash-sybol)

@sgiehl
Copy link
Member

sgiehl commented Feb 18, 2022

@melker That minus sign differs from the english one. Even though it's not really good visible in some fonts.
In my browser a can see a small difference in the length of the signs below:

"minusSign": "−",
"minusSign": "-",

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...

@melker
Copy link
Author

melker commented Feb 18, 2022

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)

@sgiehl

@sgiehl
Copy link
Member

sgiehl commented Feb 18, 2022

So you need to make the pos/neg check locale aware.

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.

@tsteur
Copy link
Member

tsteur commented Feb 20, 2022

@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 minusSign to detect negative values?

@sgiehl
Copy link
Member

sgiehl commented Feb 21, 2022

@tsteur yes that might work. Even though it would be more a workaround than a proper fix.

@sgiehl
Copy link
Member

sgiehl commented Feb 21, 2022

@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 sgiehl self-assigned this Feb 21, 2022
@tsteur
Copy link
Member

tsteur commented Feb 21, 2022

@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.

@tsteur tsteur added this to the 4.10.0 milestone Feb 21, 2022
@sgiehl
Copy link
Member

sgiehl commented Feb 21, 2022

If the additional api output is a problem, we can simply remove it by default and only add it for internal requests when needed

@tsteur
Copy link
Member

tsteur commented Feb 22, 2022

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.

@tsteur tsteur modified the milestones: 4.10.0, 4.9.0 Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: i18n For issues around internationalisation and localisation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants