endstone::Language
Represents the interface for translating text into different languages.
Functions:
Name | Description |
---|---|
getLocale | Gets the current locale. |
translate | Translates a given text into the current locale. |
translate | Translates a given text into a specific locale. |
translate | Translates a given text using a set of parameters for the current locale. |
translate | Translates a given text using a set of parameters for a specific locale. |
translate | Translates a Translatable object into the current locale. |
translate | Translates a Translatable object into a specific locale. |
getLocale
std::string getLocale() const
Gets the current locale.
Returns:
A string representing the current locale (e.g., “en_US”).
translate
std::string translate(std::string text) const
Translates a given text into the current locale.
Parameters:
text
The text to be translated.
Returns:
The translated text in the current locale.
std::string translate(std::string text, std::string locale) const
Translates a given text into a specific locale.
Parameters:
text
The text to be translated.locale
The locale identifier for the desired translation (e.g., “en_US”).
Returns:
The translated text in the specified locale.
std::string translate(std::string text, std::vector<std::string> params) const
Translates a given text using a set of parameters for the current locale.
Parameters:
text
The text to be translated.params
A list of parameters to be used in the translation.
Returns:
The translated text in the current locale, with parameters applied.
std::string translate(std::string text, std::vector<std::string> params,
std::string locale) const
Translates a given text using a set of parameters for a specific locale.
Parameters:
text
The text to be translated.params
A list of parameters to be used in the translation.locale
The locale identifier for the desired translation (e.g., “en_US”).
Returns:
The translated text in the specified locale, with parameters applied.
std::string translate(Translatable translatable) const
Translates a Translatable object into the current locale.
Parameters:
translatable
A Translatable object containing text and parameters.
Returns:
The translated text in the current locale.
std::string translate(Translatable translatable, std::string locale) const
Translates a Translatable object into a specific locale.
Parameters:
translatable
A Translatable object containing text and parameters.locale
The locale identifier for the desired translation (e.g., “en_US”).
Returns:
The translated text in the specified locale.