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() constGets the current locale.
Returns:
A string representing the current locale (e.g., “en_US”).
translate
std::string translate(std::string text) constTranslates a given text into the current locale.
Parameters:
textThe text to be translated.
Returns:
The translated text in the current locale.
std::string translate(std::string text, std::string locale) constTranslates a given text into a specific locale.
Parameters:
textThe text to be translated.localeThe 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) constTranslates a given text using a set of parameters for the current locale.
Parameters:
textThe text to be translated.paramsA 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) constTranslates a given text using a set of parameters for a specific locale.
Parameters:
textThe text to be translated.paramsA list of parameters to be used in the translation.localeThe 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) constTranslates a Translatable object into the current locale.
Parameters:
translatableA Translatable object containing text and parameters.
Returns:
The translated text in the current locale.
std::string translate(Translatable translatable, std::string locale) constTranslates a Translatable object into a specific locale.
Parameters:
translatableA Translatable object containing text and parameters.localeThe locale identifier for the desired translation (e.g., “en_US”).
Returns:
The translated text in the specified locale.