Review Request 127800: Format number in KLocalizedString::subs

Chusslove Illich caslav.ilic at gmx.net
Sun May 1 17:29:36 UTC 2016



> On Мај 1, 2016, 6:40 по п., Chusslove Illich wrote:
> > To have localized numbers is the expected behavior (and documented as such). But it was "temporarily" disabled between kdelibs and KF5, until replacements for KLocale were decided. I don't remember why I didn't switch to %L1 at that moment, since it was available too... Well, I guess best to commit this and see later if there is any trouble.
> > 
> > Did you run unit tests? Could be some of them needs adapting.
> 
> Kai Uwe Broulik wrote:
>     The unit tests fail (2 out of 4) locally both with and without this patch.
> 
> Chusslove Illich wrote:
>     Hm, and which are these failing tests? When I run them, they all pass (including expected fails).
>     
>     With the patch, I had to change in autotests/klocalizedstringtest.cpp one comparison literal from " 4.20" to " 4,20".
> 
> Kai Uwe Broulik wrote:
>     Ah, they pass, but only if I run them with LANG=en_US
>     
>     ```
>     FAIL!  : KI18nDeclarativeTest::testLocalizedContext(plural translation with domain) Compared values are not the same
>        Actual   (object->property(propertyName.toUtf8().constData()).toString()): "In 3 Sekunden"
>        Expected (value)                                                         : "in 3 seconds"
>        Loc: [/home/kaiuwe/Projekte/kf5/src/frameworks/ki18n/autotests/ki18ndeclarativetest.cpp(60)]
>        
>     FAIL!  : KLocalizedStringTest::semanticTags() Compared values are not the same
>        Actual   (xi18nc("@info", "Apply color scheme <resource>%1</resource>?", "XXX")): "<html>Apply color scheme \u201EXXX\u201C?</html>"
>        Expected (QString("<html>Apply color scheme “XXX”?</html>"))                    : "<html>Apply color scheme \u201CXXX\u201D?</html>"
>        Loc: [/home/kaiuwe/Projekte/kf5/src/frameworks/ki18n/autotests/klocalizedstringtest.cpp(351)]
>     ```

Ok, there's something strange with those two failing tests, that has nothing to do with the current patch.

But then what is also strange is that with patched version you don't get a failure on that number format test. Maybe you don't have locale fr_FR.UTF-8 generated on the system, and then it falls back to C locale.

Anyway, then just make that change in literals (" 4.20" to " 4,20"), and we call it good. (Even if then you should get failure on that test :)


- Chusslove


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127800/#review95056
-----------------------------------------------------------


On Мај 1, 2016, 12:47 пре п., Kai Uwe Broulik wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127800/
> -----------------------------------------------------------
> 
> (Updated Мај 1, 2016, 12:47 пре п.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: ki18n
> 
> 
> Description
> -------
> 
> Use %L1 instead of %1 which tells it it's a number.
> 
> This way I get decimal indicator and thousands separators according to my locale in eg. KUnitConversion
> 
> 
> Diffs
> -----
> 
>   src/klocalizedstring.cpp fc80135 
> 
> Diff: https://git.reviewboard.kde.org/r/127800/diff/
> 
> 
> Testing
> -------
> 
> 0,00094697205065430554 Meilen and 1.524 Millimeter
> instead of
> 0.00094697205065430554 Meilen and 1524 Millimeter
> 
> 
> Thanks,
> 
> Kai Uwe Broulik
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160501/30398c13/attachment.html>


More information about the Kde-frameworks-devel mailing list