OptimizedTranslation
Compressed translation lookup without contexts or plural-form selection.
Generate from a nonempty Translation in a TOOLS_ENABLED build; Generate returns false in a normal export template. This depends on the binary build, not Engine.IsEditorHint. Prepare the resource ahead of time and use it for runtime lookup. Generate success promises neither faster lookup nor a particular compression ratio.
The current generator skips context-bearing source entries with a warning and stores only the first plural form. GetMessage ignores the requested context; GetPluralMessage returns the same entry regardless of n. Use Translation for complete context and plural support.
Original keys are not retained: GetMessageList returns an empty array and GetMessageCount returns 0 with a warning even when lookup works. GetTranslatedMessageList is available without source keys. Inherited AddMessage, EraseMessage and Messages operate on a separate base map rather than the compressed table. To change lookup, edit the source Translation and Generate again.
Windows headless checks covered generation, Unicode, source independence, ignored query context, loss of plural selection and inherited mutation behavior. Skipped context-bearing source entries, empty input and source-key enumeration were source-reviewed only; performance and exported-template execution were not tested.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
OptimizedTranslationConstructor
public OptimizedTranslation();Creates an empty compressed table; lookup is empty until successful Generate or loading a prepared resource. Do not use inherited editing methods to change compressed translations. Dispose the owned resource after use.
Methods1
Generatebool
public bool Generate(Translation from);In a TOOLS_ENABLED build rebuilds the compressed table from a nonempty Translation and copies Locale. Skips context-bearing entries with a warning and keeps only the first plural form; rule overrides are not copied. Later source changes do not affect the result. Returns false in a normal export template. Empty/unsuitable input can produce a diagnostic; false does not establish state rollback.
| Name | Type | Default |
|---|---|---|
from | Translation | — |
fromNonempty source Translation; use context-free single-form entries to preserve meaning. Not an OptimizedTranslation without recoverable source keys.
booltrue after successful generation; false outside TOOLS_ENABLED or for rejected input. Not a speed metric or evidence of context support.