Transforms resolved localization values before they are handed back to the caller.
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.
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; } }
| Method | Description |
|---|---|
| PostProcessValue | Returns the transformed value, or the value unchanged. |