Thread overview
[Issue 6925] Thousands grouping syntax in writef?
Feb 06, 2021
Berni44
Feb 07, 2021
Berni44
Feb 13, 2021
Walter Bright
[Issue 6925] Obey locale for thousands grouping syntax in writef?
Mar 28, 2021
Berni44
Apr 11, 2021
Berni44
Apr 11, 2021
Berni44
October 15, 2016
https://issues.dlang.org/show_bug.cgi?id=6925

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |andrei@erdani.com

--
February 06, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@bernis-buecher.de

--- Comment #2 from Berni44 <bugzilla@bernis-buecher.de> ---
Meanwhile

writef("%.2,f", 1234567.89);

does this grouping. Result: "1,234,567.89" It does not support a locale though. And if I should guess, it will never do, because that would make the functions non pure. A possible approach would probably be, to add a special module for localization that calls writef and modifies the result according to the locale.

--
February 07, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

--- Comment #3 from Andrei Alexandrescu <andrei@erdani.com> ---
(In reply to Berni44 from comment #2)
> Meanwhile
> 
> writef("%.2,f", 1234567.89);
> 
> does this grouping. Result: "1,234,567.89" It does not support a locale though. And if I should guess, it will never do, because that would make the functions non pure. A possible approach would probably be, to add a special module for localization that calls writef and modifies the result according to the locale.

A way to keep purity with locales would be to pass the locale into the functions, e.g.

writef(mylocale, "%.2,f", 1234567.89);

--
February 07, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

--- Comment #4 from Berni44 <bugzilla@bernis-buecher.de> ---
(In reply to Andrei Alexandrescu from comment #3)
> A way to keep purity with locales would be to pass the locale into the functions, e.g.
> 
> writef(mylocale, "%.2,f", 1234567.89);

Sure, but it would make the functions much more complicated - for example think of different digit shapes used in some areas of the world or even printing from right to left (what's the minus-flag supposed to do in that case?)... I'd prefer to have localization in a wrapper in a different module.

--
February 13, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=3248

--
March 28, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Thousands grouping syntax   |Obey locale for thousands
                   |in writef?                  |grouping syntax in writef?

--
April 11, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

--- Comment #5 from Berni44 <bugzilla@bernis-buecher.de> ---
I'm closing this, because the support for grouping exists and localization is a different thing. I opened a new one for this: Issue 21819.

--
April 11, 2021
https://issues.dlang.org/show_bug.cgi?id=6925

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--