Re: [Fwd: Re: [whatwg] simple numbers]

fantasai skrev:
> Original message:
> http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-December/013148.html 

Let's see, I'm Keryx web (or at least that's one of my mail accounts...) 
and I started the discussion about numbers in HTML and CSS.

I have not had any time to read mails on this list for a while, but saw 
today that fantasai picked up on Ian's suggestion from WHAT-WG that this 
item should be discussed here.

First of all it's beyond me that so few react. Today we have a usability 
problem as well as an accessibility problem. And if one would like to do 
a spreadsheet-like webapp there also is a technical problem. (What's the 
value of the sum of A1 and A2 if A1 is "123,222.11" and A2 is "2.014E5?)

In short: We need a way to format numbers, to provide i18n with kept 
accessibility and improved usability.

I talked about an implementation that is almost here already (used by 
MSIE when importing to Excel):

-mso-number format

I talked about an implementation that is already in the W3C portfolio:

XSLT's format-number()

This might be particularly easy to implement in CSS, since most browsers 
already support XSLT.

A third source of inspiration might be ICU: 
http://icu-project.org/userguide/formatNumbers.html

A question might be why I don't just use XSLT or ICU server-side 
(especially now that PHP is getting ICU-support).

To which I answer: Media-specific rules are impossible to do that way. 
@media screen should perhaps see numbers formatted according to locale 
with thousand separators. @media speech OTOH should perhaps hear words 
like "billion", "million" and "thousand" be spelled out.

Today I've sort of solved it this way:

<span title="321 thousand 321 point 14">321,321.14</span>

Or in Swedish:

<span class="number" title="321 tusen 321 komma 14">321 321,14</span>

With:
.number {
     white-space: nowrap;
}

A solution that is ugly, not always reliable and has a lot of disadvantages.


Lars Gunther

Received on Wednesday, 2 January 2008 10:22:45 UTC