LocalizableString
A resolved player-facing string that carries its own re-resolution context (locale key
+ frozen ICU args) so it can be re-resolved cheaply when the active locale changes.
Use it instead of a plain string when needing to switch locale
mid-session: calling Resolve() re-runs the resolution through the runtime’s
current locale and updates Text in place — no second round-trip to the
runtime required.
public sealed class LocalizableString
Inheritance System.Object → LocalizableString
Example
// Locale-switch + re-resolve pattern (no second GetChoices call needed):
runtime.LoadLocale("ja", "{}");
runtime.SetActiveLocale("ja");
var choices = runtime.GetChoices();
foreach (var choice in choices.Choices)
{
choice.LocalizableTitle?.Resolve(); // updates LocalizableTitle.Text to the new locale
Console.WriteLine(choice.LocalizableTitle?.Text ?? choice.Title ?? "");
}
Remarks
LocalizableString instances are returned as optional siblings on choice and event
objects: Choice.LocalizableTitle, DialogueEvent.LocalizableText, and
SequenceEvent.LocalizableText. Hosts that never switch locale mid-session can
ignore LocalizableString entirely and read the plain string properties
(Title, Text) directly.
Pull-based and forward-mutation clean: nothing is notified automatically. After calling
SetActiveLocale(string), iterate the objects you’re holding and call
Resolve() on each LocalizableString to synchronise their Text.
Properties
Text
Current resolved + ICU-formatted display text. Updated in place by Resolve().
public string Text { get; }
Property Value
Methods
Resolve()
Re-resolves under the runtime’s current active locale and updates Text in place. The frozen ICU args are reused unchanged; only the locale moves. Call this after SetActiveLocale(string) to synchronise display text without re-querying the runtime.
public string Resolve();
Returns
System.String
The newly resolved text (same value now held by Text).
ToString()
Returns the current resolved text (same as Text). Allows a
LocalizableString to be used anywhere a plain string is accepted via
implicit string interpolation or object.ToString().
public override string ToString();
Returns
System.String
The current value of Text.