using TMPro; using UnityEngine; public static class LocaleUI { public static void SetText(Transform root, string path, string key) { if (root == null || string.IsNullOrEmpty(key)) return; TMP_Text text = string.IsNullOrEmpty(path) ? root.GetComponent() : UIViewUtility.Text(root, path); if (text != null) text.text = L.Get(key); } public static void SetFormat(Transform root, string path, string key, params object[] args) { if (root == null || string.IsNullOrEmpty(key)) return; TMP_Text text = string.IsNullOrEmpty(path) ? root.GetComponent() : UIViewUtility.Text(root, path); if (text != null) text.text = L.F(key, args); } public static void ApplyLocalizedTmp(Transform root) { if (root == null) return; var items = root.GetComponentsInChildren(true); for (int i = 0; i < items.Length; i++) items[i].Apply(); } }