HikoGUI
A low latency retained GUI
|
#include <hikogui/l10n/txt.hpp>
Public Member Functions | |
txt (txt const &other) noexcept | |
txt (txt &&other) noexcept | |
txt & | operator= (txt const &other) noexcept |
txt & | operator= (txt &&other) noexcept |
template<typename... Args> | |
txt (std::string msg_id, Args &&...args) noexcept | |
Construct a localizable message. | |
constexpr bool | empty () const noexcept |
constexpr | operator bool () const noexcept |
Check if the message is in use. | |
gstring | translate (std::locale const &loc=os_settings::locale(), std::vector< language_tag > const &languages=os_settings::language_tags()) const noexcept |
Translate and format the message. | |
gstring | translate (std::vector< language_tag > const &languages) const noexcept |
Translate and format the message. | |
gstring | original () const noexcept |
operator std::string () const noexcept | |
Friends | |
constexpr friend bool | operator== (txt const &lhs, txt const &rhs) noexcept |
A localizable message.
The translation and formatting of the message is delayed until displaying it to the user. This allows the user to change the language while the application is running.
|
inlinenoexcept |
Construct a localizable message.
It is recommended to use the parentheses form of the constructor so that it will look like a function which is recognized by the gettext
tool.
msg_id | A English string that is looked up in the translation database or, when not found, as-is. The msg_id may contain placeholders using the std::format format. Plurality is based on the first std::integral arguments. |
first_arg | The first argument passed to std::format() . |
args | Arguments passed to std::format() . |
|
inlineexplicitconstexprnoexcept |
Check if the message is in use.
|
inlinenoexcept |
Translate and format the message.
Find the translation of the message, then format it.
loc | The locale to use when formatting the message. |
languages | A list of languages to search for translations. |
|
inlinenoexcept |
Translate and format the message.
Find the translation of the message, then format it.
languages | A list of languages to search for translations. |