Пример #1
0
        private static LanguageTag GetCurrentLanguageTag()
        {
            var tag = _currentAsyncLocalLanguageTag.Value;

            if (string.IsNullOrWhiteSpace(tag))
            {
                tag = DefaultLocaleStr;
            }

            var ret = LanguageTagManager.Get(tag);

            if (ret == null)
            {
                SetCurrentLanguageTag(DefaultLocaleStr);
                ret = LanguageTagManager.Create(DefaultLocaleStr);
            }

            return(ret);
        }
 private static LanguageTag GetParentLanguageTag(string langTag)
 {
     return(LanguageTagManager.Create(langTag));
 }
Пример #3
0
 /// <summary>
 /// Convert <see cref="Locale"/> to <see cref="LanguageTag"/>.
 /// </summary>
 /// <param name="locale"></param>
 /// <returns></returns>
 public static LanguageTag AsLanguageTag(this Locale locale)
 {
     return(LanguageTagManager.Create(locale.GetLanguageTagText()));
 }