class

FLocalizationManager

Module
Core
Header
#include "Core/Localization.h"
Namespace
Mowo

Public functions

ReturnsNameDescription
FLocalizationManager&Get
voidSetLocaleChanging the locale bumps the revision and fires every registered callback, which is how already-built UI re-resolves without being torn down.
const std::string&GetLocale
voidSetFallbackLocaleThe locale a miss in the active one falls through to before the source string.
const std::string&GetFallbackLocale
uint32_tGetRevisionIncremented on every locale change.
uint32_tAddLocaleChangedCallbackReturns a handle for RemoveLocaleChangedCallback.
voidRemoveLocaleChangedCallback
voidAddEntry
uint32_tAddEntriesFromTextParse "key=value" lines (blank lines skipped; whitespace around the key trimmed) into (locale, ns).
const std::string*Find
const FStringTableEntry*FindEntry
std::stringResolveActive locale → fallback locale → the authored source string.
EPluralCategoryPluralCategoryCLDR cardinal category of count under locale's rules (integer counts only — game quantities are integers).
EPluralCategoryOrdinalCategoryCLDR ordinal category ("1st", "2nd", "3rd", "4th" in English; "1er" against everything else in French).
const char*PluralSuffix"zero"/"one"/"two"/"few"/"many"/"other"
std::stringResolvePluralPlural-aware resolve: variants live in the tables as key.one, key.few, key.many, key.other.
std::stringResolveSelectGender / arbitrary select: variants live as key.<form> with key.other as the catch-all, so "greeting.male" / "greeting.female" / "greeting.other" is one table and one call.
std::vector<std::string>GetLoadedLocalesEvery locale that has at least one entry, sorted.
voidSetPseudoLocalizationPseudo-localization: every string that resolves through a table (or its source) comes back accented, about a third longer and bracketed — "[Ƥĺàý ~~]".
boolIsPseudoLocalizationEnabled
std::stringPseudoLocalize
voidSetMissingKeyPolicy
EMissingKeyPolicyGetMissingKeyPolicy
const std::unordered_set<std::string>&GetMissingKeysDistinct (namespace, key) pairs that resolved to their source string while tables were loaded.
voidClear

Function details

Get

C++
static FLocalizationManager& Get()

SetLocale

C++
void SetLocale(const std::string& locale)

Changing the locale bumps the revision and fires every registered callback, which is how already-built UI re-resolves without being torn down. Setting the locale it already has does neither.

GetLocale

C++
const std::string& GetLocale() const

SetFallbackLocale

C++
void SetFallbackLocale(const std::string& locale)

The locale a miss in the active one falls through to before the source string. Defaults to "en".

GetFallbackLocale

C++
const std::string& GetFallbackLocale() const

GetRevision

C++
uint32_t GetRevision() const

Incremented on every locale change. A cache keyed on it re-derives exactly once per switch instead of comparing strings every frame.

AddLocaleChangedCallback

C++
uint32_t AddLocaleChangedCallback(std::function<void(const std::string&)> callback)

Returns a handle for RemoveLocaleChangedCallback. The callback runs inside SetLocale, on the thread that called it.

RemoveLocaleChangedCallback

C++
void RemoveLocaleChangedCallback(uint32_t handle)

AddEntry

C++
void AddEntry(const std::string& locale, const std::string& ns, const std::string& key, const std::string& value, const std::string& source = std::string())

AddEntriesFromText

C++
uint32_t AddEntriesFromText(const std::string& locale, const std::string& ns, const std::string& text)

Parse "key=value" lines (blank lines skipped; whitespace around the key trimmed) into (locale, ns). A comment line of the form "# @source <text>" attaches that source string to the NEXT entry, which is how an extracted table records what its translations were made against; every other '#' line is ignored. Returns entries added.

Find

C++
const std::string* Find(const std::string& locale, const std::string& ns, const std::string& key) const

FindEntry

C++
const FStringTableEntry* FindEntry(const std::string& locale, const std::string& ns, const std::string& key) const

Resolve

C++
std::string Resolve(const std::string& ns, const std::string& key, const std::string& fallback) const

Active locale → fallback locale → the authored source string.

PluralCategory

C++
static EPluralCategory PluralCategory(const std::string& locale, int64_t count)

CLDR cardinal category of count under locale's rules (integer counts only — game quantities are integers). Region subtags are ignored ("ru-RU" → "ru"); unknown languages use the English rule, so a new locale degrades to two forms instead of crashing or pluralizing Russian with an English rule silently — the table fallback below still finds .other. The rules are CLDR's cardinal rules for integers, generated by hand from plurals.xml: en de nl sv da nb fi et it es ca gl el hu tr bg ka (one/other), fr and pt-BR (0 and 1 are one; fr has many for exact millions), pt-PT, hi bn gu kn mr fa (0 and 1 are one), ru uk be, pl, cs sk, hr sr bs, lt, lv, ro, he, sl, mk, ar, cy, ga, and the no-plural group ja zh ko vi th id ms lo my km.

OrdinalCategory

C++
static EPluralCategory OrdinalCategory(const std::string& locale, int64_t count)

CLDR ordinal category ("1st", "2nd", "3rd", "4th" in English; "1er" against everything else in French). Unknown languages are Other.

PluralSuffix

C++
static const char* PluralSuffix(EPluralCategory category)

"zero"/"one"/"two"/"few"/"many"/"other"

ResolvePlural

C++
std::string ResolvePlural(const std::string& ns, const std::string& key, int64_t count, const std::string& fallback) const

Plural-aware resolve: variants live in the tables as key.one, key.few, key.many, key.other. Ladder: active-locale category → active-locale .other → fallback-locale category → fallback-locale .other → source. Every "{n}" in the winning pattern is replaced with the count, so callers write one line: ResolvePlural("Game", "cards_left", n, "{n} cards").

ResolveSelect

C++
std::string ResolveSelect(const std::string& ns, const std::string& key, const std::string& form, const std::string& fallback) const

Gender / arbitrary select: variants live as key.<form> with key.other as the catch-all, so "greeting.male" / "greeting.female" / "greeting.other" is one table and one call. Same ladder as the plural resolve, with the caller's form in place of the plural category.

GetLoadedLocales

C++
std::vector<std::string> GetLoadedLocales() const

Every locale that has at least one entry, sorted. This is what a language selector lists when nothing has enumerated the content directory for it.

SetPseudoLocalization

C++
void SetPseudoLocalization(bool enabled)

Pseudo-localization: every string that resolves through a table (or its source) comes back accented, about a third longer and bracketed — "[Ƥĺàý ~~]". A string that still reads in plain English was never localized; one whose bracket is cut off does not fit a longer language. Placeholders, |plural(...) forms, markup tags and entities are left intact. Switching it bumps the revision like a locale change.

IsPseudoLocalizationEnabled

C++
bool IsPseudoLocalizationEnabled() const

PseudoLocalize

C++
static std::string PseudoLocalize(const std::string& text)

SetMissingKeyPolicy

C++
void SetMissingKeyPolicy(EMissingKeyPolicy policy)

GetMissingKeyPolicy

C++
EMissingKeyPolicy GetMissingKeyPolicy() const

GetMissingKeys

C++
const std::unordered_set<std::string>& GetMissingKeys() const

Distinct (namespace, key) pairs that resolved to their source string while tables were loaded. A dev overlay and the tests read this instead of scraping stderr.

Clear

C++
void Clear()
Generated from Core/Localization.h via core.json · Nov 5, 2026Version 1.0.0