Update locale docs

This commit is contained in:
Victor Zverovich 2022-09-14 06:38:29 -07:00
parent 2d66ad5d33
commit 6b8144a5ac

View File

@ -156,19 +156,6 @@ Compatibility
.. doxygentypedef:: fmt::string_view .. doxygentypedef:: fmt::string_view
Locale
------
All formatting is locale-independent by default. Use the ``'L'`` format
specifier to insert the appropriate number separator characters from the
locale::
#include <fmt/core.h>
#include <locale>
std::locale::global(std::locale("en_US.UTF-8"));
auto s = fmt::format("{:L}", 1000000); // s == "1,000,000"
.. _format-api: .. _format-api:
Format API Format API
@ -404,6 +391,23 @@ normally don't do any allocations for built-in and string types except for
non-default floating-point formatting that occasionally falls back on non-default floating-point formatting that occasionally falls back on
``sprintf``. ``sprintf``.
Locale
------
All formatting is locale-independent by default. Use the ``'L'`` format
specifier to insert the appropriate number separator characters from the
locale::
#include <fmt/core.h>
#include <locale>
std::locale::global(std::locale("en_US.UTF-8"));
auto s = fmt::format("{:L}", 1000000); // s == "1,000,000"
.. doxygenfunction:: format(const Locale& loc, format_string<T...> fmt, T&&... args) -> std::string
.. doxygenfunction:: format_to(OutputIt out, const Locale& loc, format_string<T...> fmt, T&&... args) -> OutputIt
.. doxygenfunction:: formatted_size(const Locale& loc, format_string<T...> fmt, T&&... args) -> size_t
.. _ranges-api: .. _ranges-api:
Range and Tuple Formatting Range and Tuple Formatting