示例#1
0
 public string GetFullName( CldrLocale locale )
 {
     var dispNames = locale.LocaleDisplayNames;
     string text;
     if ( dispNames.LanguageNames.TryGetValue( Name, out text ) ) {
         return text;
     }
     if ( _language.HasValue() && dispNames.LanguageNames.TryGetValue( _language, out text ) ) {
         string suffix = "";
         if ( _territory != null ) {
             suffix = dispNames.TerritoryNames.GetValueOrDefault( _territory );
         }
         if ( _script != 0 ) {
             suffix = locale.Concat( suffix, locale.GetScriptDisplayName( _script ) );
         }
         if ( _variant.HasValue() ) {
             suffix = locale.Concat( suffix, locale.GetVariantDisplayName( _variant ) );
         }
         if ( suffix.HasValue() ) {
             string format = locale.LocalePattern;
             if ( format.HasValue() ) {
                 text = string.Format( format, text, suffix );
             } else {
                 text += " (" + suffix + ")";
             }
         }
         return text;
     }
     return null;
 }
示例#2
0
 internal CldrLocale(CldrLoader loader, CldrLocale parent, LanguageInfo info)
     : base(loader, parent, info.Code)
 {
     _info       = info;
     info.Locale = this;
 }
示例#3
0
 internal void ResolveDescription( CldrLocale provider )
 {
     _description = GetFullName( provider ) ?? Name;
 }