Comment by dclowd9901

Comment by dclowd9901 3 days ago

6 replies

You're talking about currency formatting while they are talking about currency value. In essence, you're both correct.

They are correct in that if you're displaying a currency value, you have to know which currency it is in, right? It wouldn't make sense for the server to be "unaware" of the locale of the value.

That said, your comment sidesteps that issue and addresses how the number itself is displayed, since ultimately the value itself is a number, but different locales display numbers differently.

So the person you're responding to is asking: since the server ostensibly already knows which currency it's in, shouldn't it already be formatting the value appropriately, and that's more a question of where one thinks localization formatting should ultimately live in web app context.

zdragnar 2 days ago

Bingo. Take the swapping of periods and commas between US and maybe Germany.

If you see a price in Euros and there's a chance the browser converts the number to my locale, then the price becomes completely ambiguous. Information is lost unless I change my locale just to see if the number changed.

If, on the other hand, the browser doesn't apply such formatting, then the number is probably the number.

What's more, wouldn't you need to specify an origin locale so the browser knows how to correctly interpret the value?

  • c-smile 2 days ago

    <output type="currency">123456.00</output> formats output using user's settings: https://www.elevenforum.com/attachments/currency_format_cont...

    If you want specific country format then you may use lang:

    <output type="currency" lang="de-DE">123456.00</output>

    Currency conversion is not a subject of a browser.

    • Muromec 2 days ago

      I got totally mad about it and wanted to write a snark comment, but then I checked what it does and it's just number formatting. It doesn't add a euro sign to it. That would have been a bad idea of course.

  • TRiG_Ireland 2 days ago

    More relevantly, take the swapping of full stops and commas (and the position of the currency sign) between Ireland and Germany, which use the same currency.

    €1,000.48 = 1.000,48€

kortilla 2 days ago

But if it’s just formatting, how is that different from the “number” type?