nCine::I18n class

Provides support for internationalization and translations.

Public static functions

static auto Get() -> I18n&
Returns primary translation catalog.
static auto GetPreferredLanguages() -> Array<String>
Returns list of user's preferred languages.
static auto GetLanguageName(StringView langId) -> StringView
Returns localized name of language by ID (ISO 639-1)
static auto TryRemoveLanguageSpecifiers(StringView langId) -> StringView
Returns language ID (ISO 639-1) without any regional/territorial specifiers.

Constructors, destructors, conversion operators

I18n()
~I18n()
I18n(const I18n&) deleted

Public functions

auto operator=(const I18n&) -> I18n& deleted
auto LoadFromFile(StringView path) -> bool
Load a catalog from file in gettext MO format, previously loaded catalog will be unloaded.
auto LoadFromFile(const std::unique_ptr<Stream>& fileHandle) -> bool
Load a catalog from stream in gettext MO format, previously loaded catalog will be unloaded.
void Unload()
Unload all loaded catalogs.
auto LookupTranslation(const char* msgid) -> StringView
Looks up raw translation by msgid.
auto LookupPlural(std::int32_t n, StringView translation) -> StringView
Looks up plural variant of translation returned by LookupTranslation()
auto GetTranslationDescription() -> StringView
Returns description of currently loaded catalog.