Page MenuHomePhabricator

Apply localization when parsing or formatting quantities
Closed, ResolvedPublic

Description

QuantityParser and QuantityRenderer currently only support the US style number format. We should use the interface language to determined the locale to use for formatting and parsing numbers.


Version: unspecified
Severity: major
Whiteboard: quantityvalue

Details

Reference
bz56685

Related Objects

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:13 AM
bzimport set Reference to bz56685.
bzimport added a subscriber: Unknown Object (MLST).

Change 97776 had a related patch set uploaded by Daniel Kinzler:
(bug #56685) make sure commafy can deal with strings.

https://gerrit.wikimedia.org/r/97776

Change 97778 had a related patch set uploaded by Daniel Kinzler:
(bug #56685) allow localized output of decimal values.

https://gerrit.wikimedia.org/r/97778

Change 97776 merged by jenkins-bot:
(bug #56685) make sure commafy can deal with strings.

https://gerrit.wikimedia.org/r/97776

Change 97789 had a related patch set uploaded by Daniel Kinzler:
(bug #56685) localize quantities when formatting

https://gerrit.wikimedia.org/r/97789

Note that Ie0ea0d5b921 and Ia6701a20 only cover formatting, not parsing.

For parsing, a bit of refactoring and infrastructure is needed: we have to 1) allow builder callbacks instead of class names in ValueParserFactory and 2) inject an appropriate builder for DecimalParser and QuantityParser into wgValueParsers. Then we can inject a DecimalParser into the QuantityParser, and a Unlocalizer into the DecimalParser.

Only then can we register an appropriate builder wgValueParsers when Wikibase is initialized.

Ideally, the builder(s) for parsers would be constructed and managed in a same way as the builders for formatters. That would however not work with ApiParseValue, which would then need to also be moved into mediawiki... or all the Parsing/Formatting logic could be factored out into a separate module.

Change 98100 had a related patch set uploaded by Daniel Kinzler:
(bug #56685) Parsing of localized decimal values.

https://gerrit.wikimedia.org/r/98100

Change 98101 had a related patch set uploaded by Daniel Kinzler:
(bug #56685) Parsing of localized quantities.

https://gerrit.wikimedia.org/r/98101

Change 97778 merged by jenkins-bot:
(bug #56685) allow localized output of decimal values.

https://gerrit.wikimedia.org/r/97778

Change 98100 merged by jenkins-bot:
(bug #56685) Parsing of localized decimal values.

https://gerrit.wikimedia.org/r/98100

Change 97789 merged by jenkins-bot:
(bug #56685) localize quantities when formatting.

https://gerrit.wikimedia.org/r/97789

Change 98101 merged by jenkins-bot:
(bug #56685) Parsing of localized quantities.

https://gerrit.wikimedia.org/r/98101

During today's demo time we found issues when editing quantities in German.

Ok it seems the issues we were having were based on the difference between setlang and uselang during demo while switching language a lot. This should work fine.