LocalizedString Struct
A serializable reference to a localized string. Use in Inspector fields.
csharp
[Serializable]
public struct LocalizedString
{
string TableId { get; } // Table identifier (empty = search all)
string Key { get; } // Translation key
string Value { get; } // Current locale translation
bool IsValid { get; } // Has valid key
bool HasTranslation { get; } // Translation exists
// Constructors
LocalizedString(string key);
LocalizedString(string tableId, string key);
// Get with formatting
string GetValue(params object[] args);
// Implicit conversion to string
public static implicit operator string(LocalizedString ls);
}Usage in MonoBehaviour:
csharp
public class UIPanel : MonoBehaviour
{
[SerializeField] private LocalizedString titleText;
[SerializeField] private LocalizedString scoreFormat;
public void UpdateUI(int score)
{
// Implicit conversion
titleLabel.text = titleText;
// With formatting
scoreLabel.text = scoreFormat.GetValue(score);
}
}