当前位置: 首页>>代码示例>>C#>>正文


C# Languages.ToString方法代码示例

本文整理汇总了C#中Languages.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Languages.ToString方法的具体用法?C# Languages.ToString怎么用?C# Languages.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Languages的用法示例。


在下文中一共展示了Languages.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SayIt

 public string SayIt(Languages langCode, string phrase)
 {
     string languagePair = BaseLanguage.ToString().ToLower() + "|" + langCode.ToString().ToLower();
     string url = String.Format("http://translate.google.com/?hl=ru&ie=UTF8&text={0}&langpair={1}", phrase, languagePair);
     string result = phrase;
     string test = "<span title=\"" + phrase + "\"";
     string codePage = String.Empty;
     if (langCode != BaseLanguage)
     {
         switch (langCode)
         {
             case Languages.BG:
                 codePage = "ISO-8859-5";
                 break;
             case Languages.RU:
                 codePage = "KOI8-R";
                 break;
             default:
                 codePage = "ISO-8859-1";
                 break;
         }
         try
         {
             WebClient webClient = new WebClient();
             webClient.Encoding = System.Text.Encoding.GetEncoding(codePage);
             result = webClient.DownloadString(url);
             result = result.Substring(result.IndexOf(test));
             result = result.Substring(result.IndexOf(">") + 1, res
开发者ID:NikolayGenov,项目名称:TelerikAcademy,代码行数:28,代码来源:Personel.cs

示例2: GetTranslator

        public ITranslator GetTranslator(Languages language)
        {
            if (!dictionary.ContainsKey(language))
                throw new Exception(string.Format("Could not find specified language: '{0}'", language.ToString()));

            return dictionary[language];
        }
开发者ID:kravasb,项目名称:Ints_to_words,代码行数:7,代码来源:TranslatorFactory.cs

示例3: Translate

 /// <summary>Translate text by using Google translate in indicated encoding.</summary>
 /// <param name="input">The input string.</param>
 /// <param name="from">Source lang</param>
 /// <param name="to">Destination lang</param>
 /// <returns>Translated string in indicated encoding</returns>
 public string Translate(string input, Languages from, Languages to, Encoding encoding)
 {
     string url = string.Format("https://translate.google.com/translate_a/single?client=t&sl={0}&tl={1}&hl=en&dt=bd&dt=ex&dt=ld&dt=md&dt=qc&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&source=btn&ssel=0&tsel=0&kc=0&q={2}",
                                         from.ToString("g"),
                                         to.ToString("g"),
                                         HttpUtility.UrlEncode(input));
     string result = null;
     using (WebClient web = new WebClient())
     {
         web.Encoding = encoding;
         web.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
         result = web.DownloadString(url);
     }
     return result.Split('[')[3].Split(',')[0];
 }
开发者ID:NonameProject,项目名称:Noname,代码行数:20,代码来源:Translator.cs

示例4: Present

 public void Present(Languages.DecompilationTarget node)
 {
     var dir = PrepFolder();
     var fileName = Path.Combine(dir, "index.htm");
     using (var wr = new StreamWriter(fileName))
     {
         wr.WriteLine("<html>");
         wr.WriteLine("<head>");
         foreach (var file in _coreFiles)
             wr.WriteLine("<link href=\"{0}\" rel=\"{1}\" type=\"text/css\" />", file.Item2, file.Item3);
         wr.WriteLine("</head>");
         wr.WriteLine("<body>");
         wr.WriteLine("<div class=\"syntaxhighlighter csharp ie\">");
         wr.WriteLine("<table border=\"0\" cellSpacing=\"0\" cellPadding=\"0\"><tr>");
         wr.WriteLine(node.ToString("text/html"));
         wr.WriteLine("</tr></table>");
         wr.WriteLine("</body>");
     }
     webBrowser1.Navigate(fileName);
 }
开发者ID:hlesesne,项目名称:Monoflector,代码行数:20,代码来源:HtmlAstPresenter.cs

示例5: Set_Language

		/// <summary>
		/// Initialisiert den ResourceManager zum auslesen der Sprache
		/// </summary>
		/// <param name="language">Die Sprache die ausgelesen werden soll</param>
		public static void Set_Language(Languages language) {
			switch (language) {
				case Languages.Auto:
					if (Thread.CurrentThread.CurrentCulture.Name.StartsWith("de")) {
						res_man = new ResourceManager("updateSystemDotNet.Internal.Localization.language.deu",
						                              Assembly.GetExecutingAssembly());
						break;
					}
					else {
						res_man = new ResourceManager("updateSystemDotNet.Internal.Localization.language.eng",
						                              Assembly.GetExecutingAssembly());
						break;
					}
				case Languages.Deutsch:
					res_man = new ResourceManager("updateSystemDotNet.Internal.Localization.language.deu",
					                              Assembly.GetExecutingAssembly());
					break;
				case Languages.English:
					res_man = new ResourceManager("updateSystemDotNet.Internal.Localization.language.eng",
					                              Assembly.GetExecutingAssembly());
					break;
			}
			Log.Instance.writeKeyValue("Language has been set to", language.ToString());
		}
开发者ID:Taipi88,项目名称:updateSystem.NET,代码行数:28,代码来源:Language.cs

示例6: CreateUrl

 private static string CreateUrl(string query, int performanceScore, int responseCount, Languages language)
 {
     return string.Format("{0}%20performance_score%3A%3E{1}&language={2}&size={3}",
         query.Replace(" ", "%20"), performanceScore - 1, language.ToString(), responseCount);
 }
开发者ID:udeyrishi,项目名称:grind-back,代码行数:5,代码来源:WebhoseClient.cs

示例7: ChangeLanguage

 /// <summary>
 /// Cambia el lenguaje del juego
 /// </summary>
 /// <param name="lang"></param>
 public static void ChangeLanguage(Languages lang)
 {
     Instance.language = lang;
     PlayerPrefs.SetString("Language",lang.ToString());
 }
开发者ID:ForsakenGS,项目名称:LostKids,代码行数:9,代码来源:GameSettings.cs

示例8: Get

        /// <summary>
        /// 获取语言项
        /// </summary>
        /// <param name="key"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public string Get(LanguagePackageKey key, Languages lang)
        {
            string dictKey = String.Concat(
                ((int)key).ToString(CultureInfo.InvariantCulture), 
                ">", 
                ((int)lang).ToString(CultureInfo.InvariantCulture));

            string outStr = null;
            if (languagePack.TryGetValue(dictKey, out outStr))
            {
                return outStr;
            }

            throw new ArgumentNullException("key", 
                String.Format("({0}->{1})不包含当前语言的配置项!", 
                lang.ToString(),
                key.ToString()));
        }
开发者ID:coodream,项目名称:cms,代码行数:24,代码来源:LanguagePackage.cs

示例9: Configure

        private void Configure(Languages keyboardAndDictionaryLanguage)
        {
            var originalDictionaryPath =
                Path.GetFullPath(Path.Combine(OriginalDictionariesSubPath,
                    Path.ChangeExtension(keyboardAndDictionaryLanguage.ToString(), DictionaryFileType)));

            if (File.Exists(originalDictionaryPath))
            {
                LoadOriginalDictionaryFromFile(originalDictionaryPath);
            }
            else
            {
                throw new ApplicationException(string.Format(Resources.DICTIONARY_FILE_NOT_FOUND_ERROR,
                    originalDictionaryPath));
            }
        }
开发者ID:EddPorter,项目名称:OptiKey,代码行数:16,代码来源:SpellingCorrectionTester.cs

示例10: Present

 public void Present(Languages.DecompilationTarget node)
 {
     textBox1.Text = node.ToString("text/plain");
 }
开发者ID:hlesesne,项目名称:Monoflector,代码行数:4,代码来源:PlainTextAstPresenter.cs

示例11: Translate

        public void Translate(string phrase, Languages lang)
        {
            this.lang = lang.ToString();
            translatedPhrase = string.Empty;
            translated.Clear();
            this.phrase = phrase;

            bool exist;
            string strResult = ConvertStreamTostring(GetHttpStream(string.Format(strRequest, phrase, lang)));
            string innerBlock = GetBlock(strResult, 2, 2, out exist);
            if (exist)
            {
                int index = 0;
                do
                {
                    index++;
                    string str = GetBlock(innerBlock, 1, index, out exist);
                    if (exist)
                    {
                        string type = GetTypeOfPhrase(ref str);
                        bool flag;
                        str = GetBlock(str, 1, 1, out flag);
                        if (flag)
                            translated.Add(new TranslatedItem(type, GetTranslatedPhrases(str)));
                    }
                }
                while (exist);
            }
            else
            {
                // maybe only one phrase

                string str = GetBlock(strResult, 3, 1, out exist);
                if (exist)
                {
                    str = str.Replace('"', ',');
                    string[] phrases = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (phrases.Length > 1 && phrases[0] != phrases[1])
                        translatedPhrase = phrases[0];
                }
            }
        }
开发者ID:ZuTa,项目名称:OwnVocabulary,代码行数:42,代码来源:Translator.cs


注:本文中的Languages.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。