carb::l10n::localizeStringFn

Defined in carb/l10n/IL10n.h

using carb::l10n::localizeStringFn = const char *(*)(const LanguageTable *table, StringIdentifier id, const LanguageIdentifier *language)

The entry point to getLocalizedStringFromHash().

Looks up a string’s translation in the localization system.

Note

This is not intended to be directly used in most situations. Typical C++ code should use CARB_LOCALIZE() and typical python code should use carb_localize() or carb_localize_hashed().

Parameters
  • table[in] The optional local language table to search first for the requested key string. If this is non-nullptr and the key string is not found in this table or the requested language is not supported by this table, the framework’s registered main table will be checked as well. This may be nullptr to only search the framework’s main table.

  • id[in] The hashed string identifier of the string to look up.

  • language[in] The language to retrieve the translated string in. This may be set to kLanguageCurrent to use the current language for the localization system (this is the default behaviour). This can also be any specific language identifier to retrieve the string in another supported language. This may also be kLanguageDefault to retrieve the string in the system’s default language if a translation is available.

Returns

The translated string is a supported language is requested and the string with the requested hash is found in the table.

Returns

nullptr if no translation is found in the table, if an unsupported language is requested, or if the key string has no mapping in the table.

Returns

An error message if the config setting to return noticeable failure strings is enabled.