Ejemplo n.º 1
0
 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 },
        });
    }
Ejemplo n.º 3
0
    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);
        }
    }
Ejemplo n.º 4
0
	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;
	}
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
 /// <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);
 }
Ejemplo n.º 7
0
	private bool IsSystemLanguage(SmartCultureInfo info)
	{
		return string.Equals(info.englishName, Application.systemLanguage.ToString(), StringComparison.OrdinalIgnoreCase);
	}
Ejemplo n.º 8
0
	/// <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);
	}
Ejemplo n.º 9
0
	/// <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);
	}