Example #1
0
        public static string GetLanguageWord(string controlID)
        {
            if (dicLangaugeList == null)
            {
                LanguagePack pack = new LanguagePack();
                pack.Init();
            }
            string strText = "";

            if (dicLangaugeList.ContainsKey(controlID.ToUpper()) == true)
            {
                LanguageWord word = dicLangaugeList[controlID.ToUpper()];
                if (SystemVariable.CurrentLangaugeCode == LanguageType.SimplifiedChinese)
                {
                    strText = word.ControlCHSText;
                }
                else if (SystemVariable.CurrentLangaugeCode == LanguageType.English)
                {
                    strText = word.ControlENText;
                }
                else if (SystemVariable.CurrentLangaugeCode == LanguageType.TraditionalChinese)
                {
                    strText = word.ControlCHTText;
                }
                else
                {
                    strText = word.ControlCHSText;
                }
            }
            return(strText);
        }
 public static string ParserString(string origin)
 {
     if (origin == string.Empty)
     {
         return(string.Empty);
     }
     return(LanguagePack.GetLanguageWord(origin));
 }
        public static string ParserMessage(string originMsg)
        {
            if (originMsg == string.Empty)
            {
                return(string.Empty);
            }
            string errMsg = originMsg;
            Regex  regex  = new Regex(@"\$([A-Za-z0-9_]+)");
            string word   = string.Empty;

            foreach (Match match in regex.Matches(errMsg))
            {
                word = LanguagePack.GetLanguageWord(match.Value);

                if (word != null && word != string.Empty)
                {
                    errMsg = errMsg.Replace(match.Value, word);
                }
            }
            return(errMsg);
        }