libnick 2025.7.3
A cross-platform base for native Nickvision applications.
|
Functions | |
bool | init (const std::string &domainName) |
Initializes the gettext system. This function should only be called once, regardless of with different domain names. | |
const std::string & | getDomainName () |
Gets the domain name used for gettext translations. | |
const std::vector< std::string > & | getAvailableLanguages () |
Gets the list of available translated languages. | |
bool | changeLanguage (const std::string &language) |
Changes the current language for gettext translations. | |
template<typename... Args> | |
std::string | fgettext (const char *msg, Args &&... args) |
Translates a message and formats it with the given arguments. | |
template<typename... Args> | |
std::string | fngettext (const char *msg, const char *msgPlural, unsigned long n, Args &&... args) |
Translates a plural message and formats it with the given arguments. | |
const char * | pgettext (const char *context, const char *msg) |
Translates a message for a given context. | |
const char * | pngettext (const char *context, const char *msg, const char *msgPlural, unsigned long n) |
Translates a plural message for a given context. |
bool Nickvision::Localization::Gettext::changeLanguage | ( | const std::string & | language | ) |
Changes the current language for gettext translations.
language | The language code to change translations to (use "C" to turn off translations and use the default language) |
std::string Nickvision::Localization::Gettext::fgettext | ( | const char * | msg, |
Args &&... | args ) |
Translates a message and formats it with the given arguments.
msg | The message to translate |
args | The arguments to format the translated message with |
std::string Nickvision::Localization::Gettext::fngettext | ( | const char * | msg, |
const char * | msgPlural, | ||
unsigned long | n, | ||
Args &&... | args ) |
Translates a plural message and formats it with the given arguments.
msg | The message to translate |
msgPlural | The plural version of the message to translate |
n | The number of objects (used to determine whether or not to use the plural version of the message) |
args | The arguments to format the translated message with |
const std::vector< std::string > & Nickvision::Localization::Gettext::getAvailableLanguages | ( | ) |
Gets the list of available translated languages.
Does not include the "C" language (the default language).
const std::string & Nickvision::Localization::Gettext::getDomainName | ( | ) |
Gets the domain name used for gettext translations.
bool Nickvision::Localization::Gettext::init | ( | const std::string & | domainName | ) |
Initializes the gettext system. This function should only be called once, regardless of with different domain names.
domainName | The domain name to use for gettext translations. Must be lowercase and contain no spaces |
const char * Nickvision::Localization::Gettext::pgettext | ( | const char * | context, |
const char * | msg ) |
Translates a message for a given context.
context | The context of the message |
msg | The message to translate |
const char * Nickvision::Localization::Gettext::pngettext | ( | const char * | context, |
const char * | msg, | ||
const char * | msgPlural, | ||
unsigned long | n ) |
Translates a plural message for a given context.
context | The context of the message |
msg | The message to translate |
msgPlural | The plural version of the message to translate |
n | The number of objects (used to determine whether or not to use the plural version of the message) |