-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: provide custom locale to fmt::format #597
Comments
The std branch of the library allows passing a locale via a buffer. Unfortunately it doesn't solve the issue with formatting of floating-point numbers because they are formatted with |
A couple of years ago I wrote such an implementation, I can look tomorrow whether I can find it |
Could we copy the implementation of snprintf from the GNU libc? |
No, fmt is BSD licensed. I suppose you could copy it from BSD libc, if you really wanted. |
Closing in favor of #147, since the problem is in floating-point formatting not locale itself. |
The library is extremely useful so that I would like to use it everywhere but it uses snprintf to print floats which uses the global locale.
One problem is when the global locale is set to a language specific locale and you still want to write some numbers with the C locale. Or you may just want to write with different locales in the same program.
Changing the global locale when you call
fmt::format
is not thread safe, so:fmt::format
if the global locale is different?fmt::format(locale_name, "format", arg1, arg2, ...);
but I guess this would mean to rewrite snprintf?
The text was updated successfully, but these errors were encountered: