Skip to content

Class endstone::Language

ClassList > endstone > Language

Represents the interface for translating text into different languages.

  • #include <endstone/lang/language.h>

Public Functions

Type Name
virtual std::string getLocale () const = 0
Gets the current locale.
virtual std::string translate (std::string text) const = 0
Translates a given text into the current locale.
virtual std::string translate (std::string text, std::string locale) const = 0
Translates a given text into a specific locale.
virtual std::string translate (std::string text, std::vector< std::string > params) const = 0
Translates a given text using a set of parameters for the current locale.
virtual std::string translate (std::string text, std::vector< std::string > params, std::string locale) const = 0
Translates a given text using a set of parameters for a specific locale.
virtual std::string translate (Translatable translatable) const = 0
Translates a Translatable object into the current locale.
virtual std::string translate (Translatable translatable, std::string locale) const = 0
Translates a Translatable object into a specific locale.
virtual ~Language () = default

Public Functions Documentation

function getLocale

Gets the current locale.

virtual std::string endstone::Language::getLocale () const = 0

Returns:

A string representing the current locale (e.g., "en_US").


function translate [⅙]

Translates a given text into the current locale.

virtual std::string endstone::Language::translate (
    std::string text
) const = 0

Parameters:

  • text The text to be translated.

Returns:

The translated text in the current locale.


function translate [2/6]

Translates a given text into a specific locale.

virtual std::string endstone::Language::translate (
    std::string text,
    std::string locale
) const = 0

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.


function translate [3/6]

Translates a given text using a set of parameters for the current locale.

virtual std::string endstone::Language::translate (
    std::string text,
    std::vector< std::string > params
) const = 0

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.


function translate [4/6]

Translates a given text using a set of parameters for a specific locale.

virtual std::string endstone::Language::translate (
    std::string text,
    std::vector< std::string > params,
    std::string locale
) const = 0

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.


function translate [⅚]

Translates a Translatable object into the current locale.

virtual std::string endstone::Language::translate (
    Translatable translatable
) const = 0

Parameters:

  • translatable A Translatable object containing text and parameters.

Returns:

The translated text in the current locale.


function translate [6/6]

Translates a Translatable object into a specific locale.

virtual std::string endstone::Language::translate (
    Translatable translatable,
    std::string locale
) const = 0

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.


function ~Language

virtual endstone::Language::~Language () = default


The documentation for this class was generated from the following file include/endstone/lang/language.h