Fix number localization for properties
ClosedPublic

Authored by astippich on Mar 24 2019, 10:50 AM.

Details

Summary

Some properties were missing proper number
localization

Diff Detail

Repository
R286 KFileMetaData
Branch
fix_value_localization
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10203
Build 10221: arc lint + arc unit
astippich created this revision.Mar 24 2019, 10:50 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptMar 24 2019, 10:50 AM
Restricted Application added subscribers: Baloo, kde-frameworks-devel. · View Herald Transcript
astippich requested review of this revision.Mar 24 2019, 10:50 AM
bruns added inline comments.Mar 24 2019, 5:06 PM
autotests/propertyinfotest.cpp
97 ↗(On Diff #54650)

This will of course fail as soon as someone translates fps, e.g. german "B/s", even more in RTL locales.

Probably the better solution is to provide the whole string verbatim, and mark it with i18n. Until then, tests should be run with an en or C locale.

astippich added inline comments.Mar 24 2019, 6:30 PM
autotests/propertyinfotest.cpp
97 ↗(On Diff #54650)

I do not want to start adding translations to unit tests, that seems over the top.
I agree it's not perfect, but it is an easy way to catch at least some missing localizations.
If you prefer, I can query startsWith(QLocale.toString())

bruns requested changes to this revision.Mar 25 2019, 2:44 PM

Please drop the changes in the unit test.

autotests/propertyinfotest.cpp
97 ↗(On Diff #54650)

QLocale().toString() is insufficient, as a locale consists of many different settings, not all are captured in toString(), e.g. decimal grouping character and decimal point.

Try running the tests with e.g. "LANG=ar ctest". It bails out at Property::Bitrate.

This revision now requires changes to proceed.Mar 25 2019, 2:44 PM
astippich updated this revision to Diff 54950.Mar 27 2019, 7:13 PM
  • remove unit test changes
bruns accepted this revision.Mar 27 2019, 7:19 PM
This revision is now accepted and ready to land.Mar 27 2019, 7:19 PM
This revision was automatically updated to reflect the committed changes.