public override void OnInspectorGUI() { if (_rootLines.Length == 0) { EditorGUILayout.LabelField("No Labels set in the label file", EditorStyles.boldLabel); if (GUILayout.Button("Open Localization Editor Window")) { CustomEditorWindow_Localizator.OpenWindow(); } } else { string value = EditorGUILayout.TextField("Current Fragment :", _target._fragmentInternal); if (!_target._fragmentInternal.Equals(value)) { _target._fragmentInternal = value; if (Application.isPlaying) { _target.OnChangeLanguage(); } else { //_target.GetComponent<Text>().text = "<" + _target.Fragment + ">"; _target.gameObject.SetActive(false); _target.gameObject.SetActive(true); } } } }
public override void OnInspectorGUI() { SystemLanguage targetLanguage = LanguageManager.Instance.CurrentLanguage; if (Application.isPlaying) { targetLanguage = (SystemLanguage)EditorGUILayout.EnumPopup("Current Language", targetLanguage); LanguageManager.Instance.CurrentLanguage = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), targetLanguage.ToString()); } else { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Default Language", EditorStyles.boldLabel); EditorGUILayout.LabelField(LanguageManager.Instance.CurrentLanguage.ToString(), EditorStyles.boldLabel); } EditorGUILayout.EndHorizontal(); } GUILayout.Space(30); GUILayout.Label("Tools", EditorStyles.boldLabel); if (GUILayout.Button("Open Localization Editor Window")) { CustomEditorWindow_Localizator.OpenWindow(); } if (GUILayout.Button("Debug languages localized")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Localizator.Path.DatabaseFilePath, FileMode.Open); Dictionary <SystemLanguage, string> dic = (Dictionary <SystemLanguage, string>)bf.Deserialize(file); file.Close(); string output = "Localized Languages : \n"; foreach (KeyValuePair <SystemLanguage, string> value in dic) { output += value.Key.ToString() + ", "; } output = output.Trim(' ').Trim(','); Debug.Log(output); } }