public IEnumerable<LanguageInfo> GetMatchingLanguages(string typedText)
        {
            if(_ethnologueLookup==null)
                _ethnologueLookup = new EthnologueLookup { Force3LetterCodes = Force3LetterCodes };

            /* This works, but the results are satisfactory yet (they could be with some enancement to the matcher
             We would need it to favor exact prefix matches... currently an exact match could be several items down the list.

            var d = new ApproximateMatcher.GetStringDelegate<WritingSystemDefinition.Iso639LanguageCode>(c => c.Name);
            var languages = ApproximateMatcher.FindClosestForms(_languageCodes, d, s, ApproximateMatcherOptions.IncludePrefixedAndNextClosestForms);
            */

            //            typedText = typedText.ToLowerInvariant();
            //
            //            foreach (Iso639LanguageCode lang in _languageCodes)
            //            {
            //                if (string.IsNullOrEmpty(typedText) // in which case, show all of them
            //                    || (lang.InvariantLowerCaseCode.StartsWith(typedText)
            //                        || lang.Name.ToLowerInvariant().StartsWith(typedText)))
            //                {
            //                    yield return lang;
            //                }
            //            }
            foreach (var language in _ethnologueLookup.SuggestLanguages(typedText))
            {
                yield return language;
            }
        }
        public IEnumerable <LanguageInfo> GetMatchingLanguages(string typedText)
        {
            if (_ethnologueLookup == null)
            {
                _ethnologueLookup = new EthnologueLookup {
                    Force3LetterCodes = Force3LetterCodes
                }
            }
            ;

            /* This works, but the results are satisfactory yet (they could be with some enancement to the matcher
             * We would need it to favor exact prefix matches... currently an exact match could be several items down the list.
             *
             * var d = new ApproximateMatcher.GetStringDelegate<WritingSystemDefinition.Iso639LanguageCode>(c => c.Name);
             * var languages = ApproximateMatcher.FindClosestForms(_languageCodes, d, s, ApproximateMatcherOptions.IncludePrefixedAndNextClosestForms);
             */

//            typedText = typedText.ToLowerInvariant();
//
//            foreach (Iso639LanguageCode lang in _languageCodes)
//            {
//                if (string.IsNullOrEmpty(typedText) // in which case, show all of them
//                    || (lang.InvariantLowerCaseCode.StartsWith(typedText)
//                        || lang.Name.ToLowerInvariant().StartsWith(typedText)))
//                {
//                    yield return lang;
//                }
//            }
            foreach (var language in _ethnologueLookup.SuggestLanguages(typedText))
            {
                yield return(language);
            }
        }
		public IEnumerable<LanguageInfo> GetMatchingLanguages(string typedText)
		{
			if (_ethnologueLookup == null)
				_ethnologueLookup = new EthnologueLookup { Force3LetterCodes = Force3LetterCodes };

			return _ethnologueLookup.SuggestLanguages(typedText);
		}
Beispiel #4
0
        public IEnumerable <LanguageInfo> GetMatchingLanguages(string typedText)
        {
            if (_ethnologueLookup == null)
            {
                _ethnologueLookup = new EthnologueLookup {
                    Force3LetterCodes = Force3LetterCodes
                }
            }
            ;

            return(_ethnologueLookup.SuggestLanguages(typedText));
        }
 public void Setup()
 {
     _ethnologue = new EthnologueLookup();
 }
		public void Setup()
		{
			_ethnologue = new EthnologueLookup();
		}
Beispiel #7
0
		public static string GetPalasoLanguageName(string lang)
		{
			var lpModel = new EthnologueLookup();
			var matchLang = lpModel.SuggestLanguages(lang.ToLower()).FirstOrDefault();
			string langname = null;
			if (matchLang != null)
				langname = matchLang.DesiredName;
			return langname ?? string.Empty;
		}