Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

IStringEntry

interface in Unity.Localization


Implements interfaces:IResourceEntry

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Represents a resource entry whose localized value is a string.

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.

Additional resources: StringEntry, IResourceEntry, ResourceTable, SharedTableData

<para>Read the localized text through the string entry view.</para>

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.