/// <summary> /// Description : Localize the component /// </summary> public void Localize() { try { // try to localize every child of the dropdown for (int i = 0; i < gameObject.GetComponent <TMP_Dropdown>().options.Count; i++) { // Component is a localize key if (gameObject.GetComponent <TMP_Dropdown>().options[i].text.Contains("key_")) { // Get the localize value ModuleLocalization.Instance().localizations.TryGetValue(gameObject.GetComponent <TMP_Dropdown>().options[i].text, out string value); // Set dropdown gameObject.GetComponent <TMP_Dropdown>().options[i].text = value; } else { Debug.LogError(Constants.ERROR_406); } } } catch (KeyNotFoundException) { Debug.LogError(Constants.ERROR_405); } }
/// <summary> /// Description : Localize the component /// </summary> public void Localize() { try { // Component is a localize key if (gameObject.GetComponent <TextMeshProUGUI>().text.Contains("key_")) { // Get the localize value ModuleLocalization.Instance().localizations.TryGetValue(gameObject.GetComponent <TextMeshProUGUI>().text, out string value); // Set label gameObject.GetComponent <TextMeshProUGUI>().text = value; } else { Debug.LogError(Constants.ERROR_406); } } catch (KeyNotFoundException) { Debug.LogError(Constants.ERROR_405); } }