private void UpdateCultureInfo()
 {
     try {
         if (PrivateUse.IsSet())
         {
             CultureInfo = new CultureInfo(OriginalLanguageTag.Replace($"-x-{PrivateUse}", string.Empty));
         }
         else
         {
             CultureInfo = new CultureInfo(OriginalLanguageTag);
         }
     }
     catch (ArgumentException) { }
 }
Пример #2
0
 // [Object]
 /// <returns>
 /// Language tag string.
 /// Supports a subset of BCP 47 language tag spec corresponding to the Windows
 /// support for language names, namely the following subtags:
 ///     language (mandatory, 2 alphachars)
 ///     script   (optional, 4 alphachars)
 ///     region   (optional, 2 alphachars | 3 decdigits)
 /// Example tags supported:
 ///     "en"            [language]
 ///     "en-US"         [language + region]
 ///     "zh"            [language]
 ///     "zh-HK"         [language + region]
 ///     "zh-123"        [language + region]
 ///     "zh-Hant"       [language + script]
 ///     "zh-Hant-HK"    [language + script + region]
 ///     "en-GB-x-ABCD" [language + region + privateuse]
 /// </returns>
 public override string ToString() => OriginalLanguageTag.IsNotNullNorEmpty() ? OriginalLanguageTag : string.Empty;