private IEnumerable <FallbackItem> Filter(List <FallbackItem> orderedItems, LanguageTag languageTag, MatchLevel matchLevel, List <int> skipHashCodes)
        {
            foreach (var item in orderedItems)
            {
                if (skipHashCodes.Contains(item.HashCodeCached))
                {
                    continue;
                }
                var score = LanguageTagMatcher.Match(languageTag, item.Value, matchLevel);

                if (score > 0)
                {
                    skipHashCodes.Add(item.HashCodeCached);
                    yield return(item);
                }
            }
        }
Example #2
0
 /// <summary>
 /// Match
 /// </summary>
 /// <param name="appLanguages"></param>
 /// <param name="matchedTag"></param>
 /// <param name="matchLevel"></param>
 /// <returns></returns>
 public int Match(LanguageTag[] appLanguages, out LanguageTag matchedTag, MatchLevel matchLevel = MatchLevel.LanguageMatch)
 {
     return(LanguageTagMatcher.Match(this, appLanguages, out matchedTag, matchLevel));
 }
Example #3
0
 /// <summary>
 /// Match
 /// </summary>
 /// <param name="appLanguage"></param>
 /// <param name="matchLevel"></param>
 /// <returns></returns>
 public int Match(LanguageTag appLanguage, MatchLevel matchLevel = MatchLevel.LanguageMatch)
 {
     return(LanguageTagMatcher.Match(this, appLanguage, matchLevel));
 }