Skip to content

The project's UI strings

UI Strings — the one thing this layer localizes, why everything else is already done, and the gate that breaks if you copy a translated value into a variable.

All documentation — Reference
On this page

TaleShardUIStrings holds the project’s own menus, buttons and labels. That is all this layer owns.

Using it

The object holds one string table per language, keyed by the project’s own language code.

Member
Tablesthe string table for each language, keyed by the project’s language code. The sync writes one table per language
Get Languagethe code this object currently holds — what was last asked for, including a value that was refused
Counthow many strings this language carries. Zero means the load failed
Get Keysevery key in the table, for an audit or a debug dump
On Changedraised after the new strings are in place, so a handler reads the new ones
Set Languageswitch tables. Never fails outward, and raises On Changed either way
Getthe string for a key, or the key itself when there is none
Try Getthe string for a key, and whether it was really there

The object follows the current language rather than owning it, and switching never needs a level reload:

Set Language with the session’s Get Languagethe project’s code — en, never a storage key
bind Set Language to the session’s On Language Changedthe chrome follows the story
bind your redraw to On Changed

The rules worth knowing

A missing key renders as the key, never as an empty string — which would be indistinguishable from a label the author deliberately left blank. Try Get is the one way to tell a present key from that fallback.

A failed load empties the table rather than keeping the previous language’s strings, so every label renders as its own key and the problem is visible at a glance instead of being half a screen of the wrong language.

Set Language never fails outward and always raises On Changed, including on a refusal. Get Language records what was last asked for — so pair it with Count, which is zero whenever nothing loaded.

What the sync writes

One string table asset per language, each a flat map: menu.title to Extraction.

Every value in it is already resolved. The sync fills a missing translation with the master language’s string, so there is no fallback chain at runtime. A non-string member is skipped and reported rather than coerced.

The table names carry exactly the codes in the project’s language list.

Written for
Unity developers · Advanced integrators
Last updated