static void LoadLanguagesDisplay() { languageCodes = LEStringTableEditor.AllLangsVisual.Keys.ToArray(); langIndex = Array.IndexOf(languageCodes, LEStringTableEditor.CurrentLanguage); if (languageCodes.Length > 0) { languages = new string[languageCodes.Length]; } else { languages = null; languageWidth = 20; return; } languageWidth = 0; for (int i = 0; i < languages.Length; i++) { LECulture info = LECultureFactory.Get(languageCodes[i]); if (info != null) { languages[i] = FormatCultureDisplay(info); } else { languages[i] = languageCodes[i]; } } }
static string FormatCultureDisplay(LECulture culture) { string nativeName = culture.NativeName; if (culture.IsRightToLeft) { nativeName = LEStringTableEditor.Logical2Visual(nativeName); } return(culture.Name + " - " + nativeName + (!culture.NativeName.Equals(culture.DisplayName) ? " - " + culture.DisplayName : string.Empty)); }
static void SelectLanguage(int index) { if (languageCodes == null || !languageCodes.IsValidIndex(index)) { return; } langIndex = index; LEStringTableEditor.CurrentLanguage = languageCodes[langIndex]; SetCurrentLanguageInManager(); groupHeightCollection.Clear(); try { currentCulture = LECultureFactory.Get(languageCodes[langIndex]); } catch { currentCulture = null; } }
public static LECulture Get(string code) { LECulture cul = null; try { if (code.Equals("ur")) { cul = new LECultureUrdu(); } else { cul = new LEBuiltInCulture(code); } } catch { cul = null; } return(cul); }
void LoadLocSetInfo() { if (locSetNames == null) { locSetNames = new string[] { "en-US-SampleScene", "es-PR-SampleScene", "fr-FR-SampleScene", "it-IT-SampleScene", "de-DE-SampleScene", "ja-JP-SampleScene", "ko-KR-SampleScene", "ru-RU-SampleScene", "ar-SA-SampleScene", "he-IL-SampleScene", "ur-SampleScene" }; } LEManager.CurrentLocSet = locSetNames[0]; GUIStyle listStyle = GUI.skin.button; if (languageDisplay == null) { // Set the display name based on the CultureInfo languageDisplay = new GUIContent[locSetNames.Length]; for (int i = 0; i < languageDisplay.Length; i++) { string culture = locSetNames[i].Replace("-SampleScene", string.Empty); try { if (culture.Equals("ar-SA")) { languageDisplay[i] = new GUIContent(LEManager.Get(LESampleKeys.ar)); } else if (culture.Equals("he-IL")) { languageDisplay[i] = new GUIContent(LEManager.Get(LESampleKeys.he)); } else if (culture.Equals("ur")) { languageDisplay[i] = new GUIContent(LEManager.Get(LESampleKeys.ur)); } else { LECulture cultureInfo = LECultureFactory.Get(culture); languageDisplay[i] = new GUIContent(cultureInfo.NativeName); } } catch { languageDisplay[i] = new GUIContent(culture); } Vector2 size = listStyle.CalcSize(languageDisplay[i]); listWidth = Mathf.Max(listWidth, size.x); } } labelStyle = new GUIStyle(GUI.skin.label); labelStyle.fontSize = 22; labelStyle.alignment = TextAnchor.MiddleCenter; labelStyle.normal.textColor = new Color(.196f, .196f, .196f); }