#include <hikogui/l10n/txt.hpp>
|
|
| 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 |
|
|
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.
◆ txt()
template<typename... Args>
| hi::v1::txt::txt |
( |
std::string | msg_id, |
|
|
Args &&... | args ) |
|
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.
- Parameters
-
| 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(). |
◆ operator bool()
| hi::v1::txt::operator bool |
( |
| ) |
const |
|
inlineexplicitnodiscardconstexprnoexcept |
Check if the message is in use.
◆ translate() [1/2]
Translate and format the message.
Find the translation of the message, then format it.
- Parameters
-
| loc | The locale to use when formatting the message. |
| languages | A list of languages to search for translations. |
- Returns
- The translated and formatted message.
◆ translate() [2/2]
Translate and format the message.
Find the translation of the message, then format it.
- Parameters
-
| languages | A list of languages to search for translations. |
- Returns
- The translated and formatted message.
The documentation for this class was generated from the following file: