| Parameter | Description |
|---|---|
| tableRef | The reference to the table collection that holds the entry. |
| entryRef | The reference to the string entry to resolve. |
| locale | The locale to resolve in; null uses the selected locale. |
| args | The Smart String arguments to format placeholders with; null when the entry takes no arguments. |
| enableFallback | Whether to walk the locale fallback chain when the locale has no value. |
| localVariables | The extra variables that Smart String placeholders resolve against, in addition to the arguments. |
string The formatted localized string, or null when the table is not loaded or the entry has no value.
Resolves a localized string synchronously, or null when it cannot be resolved without an asynchronous load.
This is the synchronous companion to ResourceDatabase.GetLocalizedStringAsync. It resolves from tables already
cached for the locale, and otherwise loads the table through any provider that implements
ISynchronousAssetProvider (direct references or a Resources load); a table that only a
purely asynchronous provider can supply resolves to null until it is loaded. Use it on the main thread when you
cannot await. Smart entries are formatted and the locale post-processing hook is applied like the async form.
<para>Reads an already-loaded string without awaiting.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class GetLocalizedStringSyncExample { public void Run() { string label = LocalizationSettings.ResourceDatabase.GetLocalizedString("UI Text", "play-button"); if (label != null) Debug.Log(label); } } }