Title (or other text property) starts with the configured prefix is replaced with the matching translation at render time and whenever SetLanguage is called.
How it works
Localization is opt-in. You callWindUI:Localization(config) once at startup to register your translations. After that, pass keys prefixed with "loc:" (the default prefix) as element titles, and WindUI replaces them with the correct string for the active language.
If a key has no translation for the current language, WindUI falls back to the "en" translations. If that also has no entry, it renders the raw key in brackets: [my-key].
The initial language is set to Creator.Language when WindUI loads. You can override it at any time by calling WindUI:SetLanguage(code).
Setting up localization
Call WindUI:Localization() with your translation table
Call this before creating any elements that use localization keys. The
Translations table maps a language code to a dictionary of key → string pairs.Use loc: keys as element titles
Prefix any element title with
"loc:" followed by the translation key. WindUI resolves it to the active language’s string automatically.LocalizationConfig fields
| Field | Type | Default | Description |
|---|---|---|---|
Enabled | boolean | false | Must be true for localization to take effect. |
Translations | table | {} | Map of language code → { [key] = string }. |
Prefix | string | "loc:" | Prefix that marks a string as a translation key. |
DefaultLanguage | string | "en" | Fallback language when a key is missing in the active language. |
Fallback behaviour
- Look up the key in the active language’s table.
- If not found, look up the key in the
"en"table. - If still not found, render
[key].
The initial language is set via
Creator.Language inside WindUI. Call WindUI:SetLanguage(code) to switch languages at any time after loading.Custom prefix
If"loc:" conflicts with your own naming, change Prefix to any string you like.