Esempio n. 1
0
        /// <summary>
        /// 得到配置节
        /// </summary>
        /// <returns></returns>
        public static TranslatorSettings GetConfig()
        {
            TranslatorSettings result = (TranslatorSettings)ConfigurationBroker.GetSection("translatorSettings");

            if (result == null)
            {
                result = new TranslatorSettings();
            }

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 翻译
        /// </summary>
        /// <param name="category"></param>
        /// <param name="sourceCulture"></param>
        /// <param name="sourceText"></param>
        /// <param name="targetCulture"></param>
        /// <param name="objParams"></param>
        /// <returns></returns>
        public static string Translate(string category, CultureInfo sourceCulture, string sourceText, CultureInfo targetCulture, params object[] objParams)
        {
            ITranslator t = TranslatorSettings.GetConfig().Translator;

            string result = t.Translate(category, sourceCulture, sourceText, targetCulture);

            if (objParams.Length > 0)
            {
                result = string.Format(result, objParams);
            }

            return(result);
        }
Esempio n. 3
0
 /// <summary>
 /// 翻译
 /// </summary>
 /// <param name="category"></param>
 /// <param name="sourceText"></param>
 /// <param name="targetCulture"></param>
 /// <param name="objParams"></param>
 /// <returns></returns>
 public static string Translate(string category, string sourceText, CultureInfo targetCulture, params object[] objParams)
 {
     return(Translate(category, TranslatorSettings.GetConfig().DefaultCulture, sourceText, targetCulture, objParams));
 }