pencil icon indicating copy to clipboard operation
pencil copied to clipboard

Zoom percentage localization not sufficient for some languages

Open scribblemaniac opened this issue 4 years ago • 4 comments

Issue Summary

The zoom amount is indicated on the bottom status bar and it should be possible to display this correctly in any supported locale.

Actual Results

The decimal separator is localized, and we get a locale-specific percentage sign character, but that character always appears to the right of the zoom number.

Expected Results

It should be possible to change the following things for a specific locale:

  • The character used for the percentage sign
  • The order of the percentage sign and number
  • The decimal separator character

See also: https://phrase.com/blog/posts/number-localization/#Percentages

The common percent sign (%) may seem like it would be uniform across all locales, but that’s not actually the case. Different locales use different symbols for the percent sign. And like currency symbols, the percent sign can go to the left or right of its associated number depending on the locale.

System Information

  • Pencil2D Version: 57966e762b78e4ca3c22237066065083fa96eda6

Developer Notes

This issue has been discussed some in #1442. The issue existed prior to that PR, but some improvements the the localization were made as related code was changed. Here is my relevant comments on the solution to this issue:

there does not seem to actually be any good way to do this. The [current solution] is basically as good as I could come up with. We could do something hackish like tr("%1%2).arg(locale.toString(...), locale.percent()), but even with comments that would be quite difficult for our translators to understand.

scribblemaniac avatar Jul 24 '21 02:07 scribblemaniac

@scribblemaniac I looked into this a bit more and honestly I’m not sure if there’s more to be done here. We already have localised number format and percent sign, the only thing missing is the order of number and sign. However, Qt doesn’t provide any mechanisms to deal with this, and even Qt’s own QProgressBar doesn’t handle that. ICU has icu::NumberFormat, but as far as I can tell from the documentation (since I’m on Linux rn), Qt doesn’t even come with ICU on Windows because it’s apparently somewhat heavyweight. Of course we could also just take a look at CLDR data and make something ourselves but honestly at that point it seems like overkill. I say we just accept that our percentage localisation won’t be perfect anytime soon and close this issue. Any thoughts?

J5lx avatar Sep 29 '21 16:09 J5lx

I agree there is currently no simple fix for this. I don't intend to fix this anytime soon myself, nor do I think it should be a high priority for anyone else. However I don't think that this issue should be closed just because we can't/won't do anything about this soon. It's still an issue until we fix it, so I would be in favour of leaving it open, indefinitely if necessary, as long as we agree that it ideally should be fixed at some point. It all comes down to how we think issues should be used.

scribblemaniac avatar Sep 29 '21 18:09 scribblemaniac

Okay then. But in that case we should track down all the other places we use percentages as well and update the issue description accordingly. This issue is in no way specific to the zoom control.

J5lx avatar Sep 29 '21 19:09 J5lx

Related Qt bug reports: QTBUG-24202, QTBUG-79902, QTBUG-81054

Vaguely related blog post: Teaching QLocale more about number formats (regarding a QLocale rework mentioned in one of the reports)

J5lx avatar Sep 29 '21 19:09 J5lx