void setUpGameLanguage() { SmartLocalization.LanguageManager languageManager = SmartLocalization.LanguageManager.Instance; SmartLocalization.SmartCultureInfo deviceCulture = languageManager.GetDeviceCultureIfSupported(); //deviceCulture.languageCode = "ru"; if (deviceCulture != null) { languageManager.ChangeLanguage(deviceCulture); } SmartLocalization.LanguageManager.SetDontDestroyOnLoad(); }
public void sendPlayerPlatformData() { SmartLocalization.LanguageManager languageManager = SmartLocalization.LanguageManager.Instance; SmartLocalization.SmartCultureInfo deviceCulture = languageManager.GetDeviceCultureIfSupported(); Analytics.CustomEvent("Player data", new Dictionary <string, object> { { "Player language", deviceCulture.nativeName }, { "Player device type", SystemInfo.deviceType.ToString() }, { "Player operation system", SystemInfo.operatingSystem }, }); }
void setUpGameName() { SmartLocalization.LanguageManager languageManager = SmartLocalization.LanguageManager.Instance; SmartLocalization.SmartCultureInfo deviceCulture = languageManager.CurrentlyLoadedCulture; if (deviceCulture.languageCode == "ru") { russianGameName.gameObject.SetActive(true); englishGameName.gameObject.SetActive(false); } else { russianGameName.gameObject.SetActive(false); englishGameName.gameObject.SetActive(true); } }
public void OnAfterDeserialize() { if(serializedKeys == null) { return; } languageDataHandler.LoadedValuesDictionary = new SortedDictionary<string,LocalizedObject>(); for(int i = 0; i < serializedKeys.Count; ++i) { languageDataHandler.LoadedValuesDictionary.Add(serializedKeys[i], serializedValues[i]); } languageDataHandler.LoadedCulture = serializedCulture; serializedKeys.Clear(); serializedValues.Clear(); serializedCulture = null; }
void Start() { languageManager = LanguageManager.Instance; SmartCultureInfo systemLanguage = languageManager.GetSupportedSystemLanguage(); if (systemLanguage != null) { languageManager.ChangeLanguage(systemLanguage); } if (languageManager.NumberOfSupportedLanguages > 0) { currentLanguageValues = languageManager.RawTextDatabase; availableLanguages = languageManager.GetSupportedLanguages(); } else { Debug.LogError("No languages are created!, Open the Smart Localization plugin at Window->Smart Localization and create your language!"); } LanguageManager.Instance.OnChangeLanguage += OnLanguageChanged; }
/// <summary> /// Checks if a specific culture info is in this collection /// </summary> /// <param name="cultureInfo">The culture info to check</param> /// <returns>If the specified culture info was in the collection</returns> public bool IsCultureInCollection(SmartCultureInfo cultureInfo) { return(FindCulture(cultureInfo) != null); }
private bool IsSystemLanguage(SmartCultureInfo info) { return string.Equals(info.englishName, Application.systemLanguage.ToString(), StringComparison.OrdinalIgnoreCase); }
/// <summary> /// Checks if a culture is supported by this application /// </summary> /// <param name="cultureInfo">The culture info to check</param> /// <returns>If the culture is supported</returns> public bool IsCultureSupported(SmartCultureInfo cultureInfo) { return IsCultureSupported(cultureInfo.languageCode); }
/// <summary> /// Change the language into a specified culture /// </summary> /// <param name="cultureInfo">The culture to change to</param> public void ChangeLanguage(SmartCultureInfo cultureInfo) { ChangeLanguage(cultureInfo.languageCode); }