IStringEntry
Represents a resource entry whose localized value is a string.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Interface
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public interface IStringEntry : IResourceEntry
Remarks
A string entry stores the text for one key in one locale, returned by IStringEntry.Value before any Smart String formatting is applied. Whether the value is formatted as a Smart String is a per-key flag on the collection's SharedTableData, not a property of the entry. The built-in implementation is StringEntry; fetch one from a table with ResourceTable.GetEntry using IStringEntry or StringEntry as the type argument.
Read the localized text through the string entry view.
Examples
using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class IStringEntryOverviewExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); shared.TableCollectionName = "UI Text"; var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = new LocaleIdentifier("en"); table.AddStringEntry("greeting", "Hello"); IStringEntry entry = table.GetEntry<IStringEntry>("greeting"); Debug.Log(entry.Value); // Hello } }}
Properties
Property | Description |
|---|---|
| Value | The localized text for this entry, before Smart String formatting. |