示例#1
0
 public static GPLanguage getDefaultLanguage()
 {
     if (defLang == null)
     {
         defLang = GPLanguageList.getShared().languages[0];
     }
     return(defLang);
 }
示例#2
0
 public void refreshLanguageList()
 {
     languages = new List <GPLanguage>();
     string[] files = GPFileHelper.EnumerateLanguageFiles();
     foreach (string s in files)
     {
         GPLanguage nlang = new GPLanguage();
         if (nlang.LoadHeader(s))
         {
             languages.Add(nlang);
         }
     }
 }
示例#3
0
        public void setCurrentLanguageId(int id)
        {
            GPUserDefaults.SetIntForKey("gcal.current.language", id);
            currentLanguageId = id;
            GPLanguage lan = findLanguageWithId(id);

            if (lan != null)
            {
                lan.loadFile(lan.LanguageFile);
                GPStrings languageStrings = lan.getStrings();
                GPStrings originalStrings = GPStrings.getOriginalStrings();
                GPStrings shared          = GPStrings.getSharedStrings();
                shared.Clear();
                shared.AddRange(originalStrings);
                shared.AddRange(languageStrings);
            }
        }
示例#4
0
        public bool IsNewVersion(GPLanguage lang)
        {
            if (lang.LanguageId <= 0 || lang.LanguageVersion <= 0)
            {
                return(false);
            }

            foreach (GPLanguage lan in languages)
            {
                if (lan.LanguageId == lang.LanguageId)
                {
                    return(lang.LanguageVersion > lan.LanguageVersion);
                }
            }

            return(true);
        }
示例#5
0
        public static GPLanguage getCurrentLanguage()
        {
            if (currLang == null)
            {
                int currLangId = GPUserDefaults.IntForKey("gcal.current.language", -1);
                List <GPLanguage> languages = GPLanguageList.getShared().languages;
                foreach (GPLanguage lang in languages)
                {
                    if (lang.LanguageId == currLangId)
                    {
                        currLang = lang;
                    }
                }

                if (currLang == null)
                {
                    return(new GPLanguage("<default>", ""));
                }
            }
            return(currLang);
        }
示例#6
0
 public static void setCurrentLanguage(GPLanguage value)
 {
     GPStrings.setSharedStrings(value.getStrings());
     currLang = value;
 }