private void GatherLocaleOptions() { string preferredCultureName = PackageLanguageManager.PreferredCulture.Name; this.availableCultures = PackageLanguageManager.DiscoverAvailableCultures(); this.availableCultureLabels = (from culture in this.availableCultures select new GUIContent(culture.NativeName)).ToArray(); this.preferredCultureIndex = Array.FindIndex(this.availableCultures, culture => culture.Name == preferredCultureName); }
private void DrawPreferredLanguageField() { EditorGUILayout.BeginHorizontal(); // "Preferred Language (BETA)" using (var content = ControlContent.Basic(TileLang.Text("Preferred Language (BETA)"))) { EditorGUI.BeginChangeCheck(); this.preferredCultureIndex = EditorGUILayout.Popup(content, this.preferredCultureIndex, this.availableCultureLabels); if (EditorGUI.EndChangeCheck()) { var selectedCulture = this.availableCultures[this.preferredCultureIndex]; PackageLanguageManager.SetPreferredCulture(selectedCulture); } } GUILayout.Space(32); using (var content = ControlContent.Basic( RotorzEditorStyles.Skin.RefreshIcon, TileLang.ParticularText("Action", "Refresh") )) { Rect refreshButtonPosition = GUILayoutUtility.GetLastRect(); refreshButtonPosition.x = refreshButtonPosition.xMax - 31 + 3; refreshButtonPosition.y = refreshButtonPosition.y - 1; refreshButtonPosition.width = 31; refreshButtonPosition.height = 21; if (RotorzEditorGUI.HoverButton(refreshButtonPosition, content)) { PackageLanguageManager.ReloadAll(); } } EditorGUILayout.EndHorizontal(); string translators = TileLang.Text("__Translators__").Trim(); if (!string.IsNullOrEmpty(translators) && translators != "-" && translators != "__Translators__") { string message = string.Format( /* list of special people names */ TileLang.Text("Special Thanks: {0}"), translators ); EditorGUILayout.HelpBox(message, MessageType.None); } }