ドキュメント

Unity Engine

Unity Engine

IPostProcessValueLocale

Transforms resolved localization values before they are handed back to the caller.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Interface
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public interface IPostProcessValueLocale

Remarks

Implement this on a Locale subclass to post-process the values resolved for that locale, such as a pseudo-locale that accents, expands, or brackets strings to test how a layout copes. ResourceDatabase calls IPostProcessValueLocale.PostProcessValue for resolved string values, after Smart String formatting has run, on both the synchronous and asynchronous paths. The generic signature lets one implementation cover other value types as well. A locale that does not implement this interface leaves resolved values untouched. Mark the implementing locale with SerializableAttribute, because the project's locale list holds locales by managed reference and a type without it deserializes as null.
Additional Resources: Locale, ResourceDatabase
A pseudo-locale that brackets every resolved string.

Examples

using System;namespace Unity.Localization.Samples{ [Serializable] public class PostProcessValueLocaleExample : Locale, IPostProcessValueLocale { public PostProcessValueLocaleExample() : base("qps-ploc", "Pseudo (bracketed)") { } public T PostProcessValue<T>(T value) => value is string text ? (T)(object)$"[{text}]" : value; }}

Methods

Method

Description

PostProcessValueReturns the transformed value, or the value unchanged.