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


C# System.Language类代码示例

本文整理汇总了C#中System.Language的典型用法代码示例。如果您正苦于以下问题:C# Language类的具体用法?C# Language怎么用?C# Language使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Language类属于System命名空间,在下文中一共展示了Language类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Lookup

        public virtual string Lookup(object itemId, string path, Language language)
        {
            var id = ToGuid(itemId);
            if (Database == null || id == null || path == null)
            {
                return null;
            }

            language = language ?? Language;
            
            var key = string.Concat(language.Name, id, path);
            return _cache.GetOrAdd(key, _ =>
            {
                var item = Database.GetItem(ID.Parse(id), language);
                if (item != null)
                {                    
                    if (path.Equals("@displayname", StringComparison.InvariantCultureIgnoreCase))
                    {
                        return item.DisplayName;
                    }
                    if (path.Equals("@templatename", StringComparison.InvariantCultureIgnoreCase))
                    {
                        return item.TemplateName;
                    }                    

                    return item[path];
                }
                return null;
            });
        }
开发者ID:vsegrad,项目名称:experience-extractor,代码行数:30,代码来源:ItemDatabaseFieldLookup.cs

示例2: Add

 public string this[ulong guid, Language language]
 {
     get
     {
         if (_stringTableSet.ContainsKey(guid))
         {
             if (_stringTableSet[guid].ContainsKey(language))
             {
                 return _stringTableSet[guid][language];
             }
         }
         return null;
     }
     set
     {
         if (_stringTableSet.ContainsKey(guid) && _stringTableSet[guid].ContainsKey(language))
         {
             if (_stringTableSet[guid][language] != value)
             {
                 _stringTableSet[guid][language] = value;
                 _stringTables[language][guid] = value;
             }
         }
         else
         {
             Add(guid, language, value);
         }
     }
 }
开发者ID:dd-dk,项目名称:sims3tools,代码行数:29,代码来源:StringTableSet.cs

示例3: GetLanguageFileExtension

 public static string GetLanguageFileExtension(Language language)
 {
     var type = typeof(Language);
     var memInfo = type.GetMember(language.ToString());
     var attributes = memInfo[0].GetCustomAttributes(typeof(FileExtensionAttribute), false);
     return ((FileExtensionAttribute)attributes[0]).Extension;
 }
开发者ID:modulexcite,项目名称:docs-8,代码行数:7,代码来源:FileExtensionHelper.cs

示例4: GetSimpleNameHandleArray

        private static string GetSimpleNameHandleArray(Type t, Language language)
        {
            if (t.IsArray && language == Language.VisualBasic)
                return t.Name.Replace('[', '(').Replace(']', ')');

            return t.Name;
        }
开发者ID:uehara,项目名称:orleans,代码行数:7,代码来源:TypeUtils.cs

示例5: Insert

		///<summary>Inserts one Language into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(Language language,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				language.LanguageNum=ReplicationServers.GetKey("language","LanguageNum");
			}
			string command="INSERT INTO language (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="LanguageNum,";
			}
			command+="EnglishComments,ClassType,English,IsObsolete) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(language.LanguageNum)+",";
			}
			command+=
				 "'"+POut.String(language.EnglishComments)+"',"
				+"'"+POut.String(language.ClassType)+"',"
				+"'"+POut.String(language.English)+"',"
				+    POut.Bool  (language.IsObsolete)+")";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				language.LanguageNum=Db.NonQ(command,true);
			}
			return language.LanguageNum;
		}
开发者ID:mnisl,项目名称:OD,代码行数:26,代码来源:LanguageCrud.cs

示例6: Book

 //Constructor
 public Book(string title, Author author, Language language, BookSection bookSection)
     : base(title)
 {
     this.BookAuthor = author;
     this.BookLanguage = language;
     this.bookSection = bookSection;
 }
开发者ID:Nikolai-Aleksiev,项目名称:Telerik-Academy-HomeWorks,代码行数:8,代码来源:Book.cs

示例7: GetWords

        public IEnumerable<WordModel> GetWords(Language from, Language to, string filter)
        {
            using (var db = GetConnection())
            {
                var translatesFrom = db.Translations.Where(t => t.Language == from && t.Value.ToLower().Contains(filter.ToLower()));

                if (translatesFrom != null && translatesFrom.Any())
                    foreach (var translateFrom in translatesFrom)
                    {
                        if (translateFrom?.Word == null)
                            continue;

                        var availableTranslations = translateFrom.Word.Translations.Where(t => t.Language == to);

                        if (availableTranslations != null && availableTranslations.Any())
                            foreach (var translation in availableTranslations)
                            {
                                var word = translation.Word;
                                yield return new WordModel
                                {
                                    DateCreated = word.DateCreated,
                                    LastSearch = word.LastSearch,
                                    Example = translation.SentenceExample,
                                    Pronunciation = translation.Pronunciation,
                                    TranslateFrom = translateFrom.Value,
                                    TranslateTo = translation.Value,
                                };
                            }
                    }
            }
        }
开发者ID:JanVargovsky,项目名称:MyDictionary,代码行数:31,代码来源:MainViewLogic.cs

示例8: TtsEspHelper

        /// <summary>
        /// Initializes a new instance of the <see cref="TtsEspHelper"/> class.
        /// </summary>
        /// <param name="language">Language.</param>
        /// <param name="voicePath">Voice font path.</param>
        /// <param name="langDllPath">Language dll path.</param>
        /// <param name="langDataPath">Language data path.</param>
        /// <param name="mode">Process mode.</param>
        public TtsEspHelper(Language language, string voicePath, string langDllPath,
            string langDataPath, ProcessMode mode)
        {
            if (string.IsNullOrEmpty(voicePath))
            {
                voicePath = null;
            }

            if (string.IsNullOrEmpty(langDllPath))
            {
                langDllPath = null;
            }

            if (string.IsNullOrEmpty(langDataPath))
            {
                langDataPath = null;
            }

            _language = language;
            if (string.IsNullOrEmpty(langDllPath) && string.IsNullOrEmpty(langDataPath))
            {
                _engine = new SP.TtsEngine((SP.Language)language, voicePath);
            }
            else if (string.IsNullOrEmpty(langDataPath))
            {
                _engine = new SP.TtsEngine((SP.Language)language, voicePath, langDllPath);
            }
            else
            {
                _engine = new SP.TtsEngine((SP.Language)language, voicePath, langDllPath, langDataPath);
            }

            _mode = mode;
        }
开发者ID:JohnsonYuan,项目名称:TTSFramework,代码行数:42,代码来源:TtsEspHelper.cs

示例9: getTextFromImageFile

        public string getTextFromImageFile(string filePath, Language selectedLanguage, string selectedMode)
        {
            string language = AspriseOCR.LANGUAGE_ENG;
            switch (selectedLanguage)
            {
                case Language.SPANISH:
                    language = AspriseOCR.LANGUAGE_SPA;
                    break;
                case Language.ENGLISH:
                    language = AspriseOCR.LANGUAGE_ENG;
                    break;
                case Language.GERMAN:
                    language = AspriseOCR.LANGUAGE_DEU;
                    break;
                case Language.FRENCH:
                    language = AspriseOCR.LANGUAGE_FRA;
                    break;
                default:
                    language = AspriseOCR.LANGUAGE_ENG;
                    break;
            }

            AspriseOCR.SetUp();

            AspriseOCR ocr = new AspriseOCR();

            ocr.StartEngine(language, AspriseOCR.SPEED_FASTEST);

            string s = ocr.Recognize(filePath, -1, -1, -1, -1, -1, AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);

            ocr.StopEngine();

            return s;
        }
开发者ID:eduardohdzc,项目名称:ocr_sim_master,代码行数:34,代码来源:AspireWrapper.cs

示例10: Compiler

        public const int DefaultTimeout = 5000; //5s

        protected Compiler(Language language, IEnumerable<KeyValuePair<string, string>> sources)
        {
            Language = language;
            Parameters = new Dictionary<string, string>(StringComparer.Ordinal);
            Sources = sources ?? new Dictionary<string, string>();
            Timeout = DefaultTimeout;
        }
开发者ID:devigned,项目名称:autorest,代码行数:9,代码来源:Compiler.cs

示例11: GetSamplesCodeBehindFileName

        /// <summary>
        /// Gets the name of the C# code behind file.
        /// </summary>
        public static string GetSamplesCodeBehindFileName(this SampleModel model, Language language = Language.CSharp)
        {
            if (language == Language.CSharp)
                return string.Format("{0}.xaml.cs", model.GetSampleName(language));

            return string.Format("{0}.xaml.vb", model.GetSampleName(language));
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:10,代码来源:SampleModelExtensions.cs

示例12: CompileGetter

        public static GetterInfo CompileGetter(this JobParser parser, Type type, string selector, Language language = null)
        {
            var slash = selector.IndexOf('/');
            
            var path = (slash != -1 ? selector.Substring(0, slash) : selector).Split(new[] {"."}, StringSplitOptions.RemoveEmptyEntries);
            var scField = slash != -1 ? selector.Substring(slash + 1) : null;

            Type valueType;
            var valueGetter = CompileGetter(type, path, out valueType);

            Func<object, ProcessingScope, object> getter = (item, scope) => valueGetter(item);
            

            if (!string.IsNullOrEmpty(scField))
            {
                valueType = typeof(string);
                getter =
                    (item, scope) =>
                        valueGetter(item).TryGet(id => scope.FieldLookup.TryGet(lu => lu.Lookup(id, scField, language)));
            }

            return new GetterInfo
            {
                Path = path,
                SitecoreField = scField,
                Type = type,
                ValueType = valueType,
                Getter = getter
            };
        }
开发者ID:vsegrad,项目名称:experience-extractor,代码行数:30,代码来源:Selectors.cs

示例13: AppendLanguage

 private void AppendLanguage(Language? language)
 {
     if (language.HasValue && language.Value != Language.Undefined)
     {
         this.builder.AppendFormat(" +language:{0}", this.location.GetLanguage(language.Value));
     }
 }
开发者ID:fakeezz,项目名称:social-sense,代码行数:7,代码来源:BingUrlBuilder.cs

示例14: CodeBlock

		public CodeBlock(string lineOfCode, int lineNumber, Language language, string propertyOrMethodName)
		{
			Value = ExtractCallOutsFromText(lineOfCode);
			LineNumber = lineNumber;
			Language = language;
			PropertyName = propertyOrMethodName?.ToLowerInvariant();
		}
开发者ID:RossLieberman,项目名称:NEST,代码行数:7,代码来源:CodeBlock.cs

示例15: GetColor

 private Color GetColor(Language lang, Color? col, bool invert)
 {
     if (invert)
         return (lang == Language.OtherLanguage) ? SystemColors.Control : (CurrentWord.Parent.ColorRecursive ?? SystemColors.Control);
     else
         return (lang == Language.German) ? SystemColors.Control : (CurrentWord.Parent.ColorRecursive ?? SystemColors.Control);
 }
开发者ID:phi1010,项目名称:votra,代码行数:7,代码来源:TestForm.cs


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