Exemple #1
0
        public static string GetLocalisedValue(string key)
        {
            if (!isInit)
            {
                Init();
            }

            string value = key;

            switch (language)
            {
            case Language.English:
                localisedEN.TryGetValue(key, out value);
                break;

            case Language.French:
                localisedFR.TryGetValue(key, out value);
                break;

            case Language.German:
                localisedDE.TryGetValue(key, out value);
                break;

            case Language.Italian:
                localisedIT.TryGetValue(key, out value);
                break;

            case Language.Spanish:
                localisedES.TryGetValue(key, out value);
                break;
            }

            if (value == null)
            {
                value = key;
            }

            //Parse the value for any needed changes
            if (value != null && value != string.Empty)
            {
                if (Application.isPlaying)
                {
                    if (TextLocalisationManager.instance != null)
                    {
                        value = TextLocalisationManager.Replace(value);
                        value = value.Replace("\\n", "\n");
                    }
                }
            }

            //Set the first letter to uppercase
            if (string.IsNullOrEmpty(value) || value.Length <= 1)
            {
                return(value);
            }
            else
            {
                return(char.ToUpper(value[0]) + value.Substring(1));
            }
        }
 public void Awake()
 {
     instance = this;
 }