/// <summary> /// Display the form to edit a language /// </summary> void displayLanguageFields() { EditorGUILayout.BeginVertical(); rightScrollPos = EditorGUILayout.BeginScrollView(rightScrollPos); if (!localizationText.hasLanguageDataLoaded()) { EditorGUILayout.EndVertical(); EditorGUILayout.EndScrollView(); return; } if (localizationText.fileAndLang.Find(x => x.language == localizationText.currentLangLoaded).file == null) { EditorGUILayout.LabelField("No JSON file in the Localized Text ", new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter }); } EditorGUILayout.LabelField("List of the " + localizationText.currentLangLoaded + " language text : ", new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter }); EditorGUILayout.Space(); // display text order by key type for (int j = 0; j < localizationTextOrdererByKey.Count; j++) { List <LocalizationElement> itemsForKeyType = localizationTextOrdererByKey[j]; string[] keySplitted = itemsForKeyType[0].key.Split('_'); EditorGUILayout.BeginHorizontal("Box"); EditorGUILayout.LabelField(keySplitted[keySplitted.Length - 1] + " : ", new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter }); // hide or display the category if (GUILayout.Button(displayKeyTypeCategory[j] ? "Hide" : "Display")) { displayKeyTypeCategory[j] = !displayKeyTypeCategory[j]; } EditorGUILayout.EndHorizontal(); if (displayKeyTypeCategory[j]) { for (int i = 0; i < itemsForKeyType.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(itemsForKeyType[i].key, GUILayout.Height(keyAndTextHeight), GUILayout.Width(200)); itemsForKeyType[i].text = EditorGUILayout.TextArea(itemsForKeyType[i].text, GUILayout.Height(keyAndTextHeight)); EditorGUILayout.EndHorizontal(); } } } EditorGUILayout.EndScrollView(); if (GUILayout.Button("Save language")) { localizationText.saveLocalizedText(); EditorGUI.FocusTextInControl(""); localizationText.unloadLocalizationData(); } EditorGUILayout.Space(); EditorGUILayout.EndVertical(); }