Class PreviewLocalization
Best-effort, edit-mode translation of localization keys for the View Preview, so the preview shows the same text the game would instead of raw keys (which are much longer and overflow the screen).
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Editor.Preview
Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
Syntax
public static class PreviewLocalization
Remarks
The runtime localization service isn't available in edit mode, so this reads the project's
StringTableCollections directly through the editor Localization API via reflection — that
way this file compiles and runs even if the Localization package/API isn't present or changes; any failure
simply leaves the original key (the preview's "Fit" zoom keeps it visible either way). Among the tables that
have a value for a key, LocalePreviewMatcher picks the one matching
LocalizationSettings.SelectedLocale (via Serenity.Global.Infrastructure.Editor.UnityLocalizationLocaleEditorUtils), falling
back to English, then to any hit. Results are cached.
Methods
ClearCache()
Drops cached lookups (e.g. when the user hits Refresh).
Declaration
public static void ClearCache()
Translate(string)
Translates key to the project's text, or returns it unchanged on any miss.
Declaration
public static string Translate(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key |
Returns
| Type | Description |
|---|---|
| string |