コード例 #1
0
        // Resolve a culture name using a string culture.
        private static String GetCultureName(RootCulture info, RootCulture str)
        {
            String name = str.ResolveLanguage
                              (info.TwoLetterISOLanguageName);
            String country = info.Country;

            if (country != null)
            {
                name = name + " (" + str.ResolveCountry(country) + ")";
            }
            return(name);
        }
コード例 #2
0
ファイル: RegionNameTable.cs プロジェクト: ForNeVeR/pnet
        // Add currency information to a NumberFormatInfo object.
        public static void AddCurrencyInfo
            (NumberFormatInfo nfi, RootCulture culture)
        {
            String country = culture.Country;

            if (country != null)
            {
                RegionName region = GetNameInfoByName(country);
                if (region != null)
                {
                    nfi.CurrencySymbol        = region.currencySymbol;
                    nfi.CurrencyDecimalDigits = region.currencyDigits;
                }
            }
        }
コード例 #3
0
        // Get the culture handler for the current culture.
        public static RootCulture GetCurrentCulture()
        {
            // Get the culture handler for the current culture.
            int           cultureID = CultureInfo.CurrentCulture.LCID;
            StringBuilder builder   = new StringBuilder();

            builder.Append(hex[(cultureID >> 12) & 0x0F]);
            builder.Append(hex[(cultureID >> 8) & 0x0F]);
            builder.Append(hex[(cultureID >> 4) & 0x0F]);
            builder.Append(hex[cultureID & 0x0F]);
            String      name    = builder.ToString();
            RootCulture culture =
                (PrimaryManager.Instantiate("CID" + name) as RootCulture);

            // Use invariant English if we couldn't find the culture.
            if (culture == null)
            {
                culture = new CNen();
            }
            return(culture);
        }
コード例 #4
0
	// Add currency information to a NumberFormatInfo object.
	public static void AddCurrencyInfo
				(NumberFormatInfo nfi, RootCulture culture)
			{
				String country = culture.Country;
				if(country != null)
				{
					RegionName region = GetNameInfoByName(country);
					if(region != null)
					{
						nfi.CurrencySymbol = region.currencySymbol;
						nfi.CurrencyDecimalDigits = region.currencyDigits;
					}
				}
			}
コード例 #5
0
 // Get the native name for a particular culture.
 public static String GetNativeName(RootCulture info)
 {
     return(GetCultureName(info, info));
 }
コード例 #6
0
 // Get the English name for a particular culture.
 public static String GetEnglishName(RootCulture info)
 {
     return(GetCultureName(info, new CNen()));
 }
コード例 #7
0
 // Get the display name for a particular culture.
 public static String GetDisplayName(RootCulture info)
 {
     return(GetCultureName(info, GetCurrentCulture()));
 }
コード例 #8
0
	// Get the native name for a particular culture.
	public static String GetNativeName(RootCulture info)
			{
				return GetCultureName(info, info);
			}
コード例 #9
0
	// Get the English name for a particular culture.
	public static String GetEnglishName(RootCulture info)
			{
				return GetCultureName(info, new CNen());
			}
コード例 #10
0
	// Get the display name for a particular culture.
	public static String GetDisplayName(RootCulture info)
			{
				return GetCultureName(info, GetCurrentCulture());
			}
コード例 #11
0
	// Resolve a culture name using a string culture.
	private static String GetCultureName(RootCulture info, RootCulture str)
			{
				String name = str.ResolveLanguage
					(info.TwoLetterISOLanguageName);
				String country = info.Country;
				if(country != null)
				{
					name = name + " (" + str.ResolveCountry(country) + ")";
				}
				return name;
			}