Beispiel #1
0
        /// <summary>
        /// Convenience method for callers using locales.  This returns the standard
        /// <see cref="CultureInfo"/> list, built from the <see cref="ICollection{T}"/> of visible ids.
        /// </summary>
        public virtual CultureInfo[] GetAvailableLocales() // ICU4N specific - was named GetAvailableLocales() in Java
        {
            // TODO make this wrap getAvailableULocales later
            ICollection <string> visIDs = GetVisibleIDs();

            CultureInfo[] locales = new CultureInfo[visIDs.Count];
            int           n       = 0;

            foreach (string id in visIDs)
            {
                CultureInfo loc = LocaleUtility.GetLocaleFromName(id);
                locales[n++] = loc;
            }
            return(locales);
        }
Beispiel #2
0
        /// <summary>
        /// Convenience method for callers using locales.  This returns the standard
        /// <see cref="CultureInfo"/> list, built from the <see cref="ICollection{T}"/> of visible ids.
        /// </summary>
        public virtual CultureInfo[] GetAvailableLocales() // ICU4N TODO: API - rename GetCultures (just like CultureInfo) - consider adding a CultureTypes filter
        {
            // TODO make this wrap getAvailableULocales later
            ICollection <string> visIDs = GetVisibleIDs();

            CultureInfo[] locales = new CultureInfo[visIDs.Count];
            int           n       = 0;

            foreach (string id in visIDs)
            {
                CultureInfo loc = LocaleUtility.GetLocaleFromName(id);
                locales[n++] = loc;
            }
            return(locales);
        }
Beispiel #3
0
        /// <summary>
        /// Convenience method for callers using locales.  This returns the standard
        /// <see cref="CultureInfo"/> list, built from the <see cref="ICollection{T}"/> of visible ids.
        /// </summary>
        public virtual CultureInfo[] GetAvailableLocales() // ICU4N TODO: API - rename GetAvailableCultures()? Need this to be consistent across the API
        {
            // TODO make this wrap getAvailableULocales later
            ICollection <string> visIDs = GetVisibleIDs();

            CultureInfo[] locales = new CultureInfo[visIDs.Count];
            int           n       = 0;

            foreach (string id in visIDs)
            {
                CultureInfo loc = LocaleUtility.GetLocaleFromName(id);
                locales[n++] = loc;
            }
            return(locales);
        }
Beispiel #4
0
 /// <summary>
 /// If a key created from id would eventually fallback to match the
 /// canonical ID of this key, return true.
 /// </summary>
 public override bool IsFallbackOf(string id)
 {
     return(LocaleUtility.IsFallbackOf(CanonicalID, id));
 }
Beispiel #5
0
 /// <summary>
 /// Convenience method for callers using locales.  This returns the standard
 /// <see cref="CultureInfo"/> list, built from the <see cref="ICollection{T}"/> of visible ids.
 /// </summary>
 public virtual CultureInfo[] GetCultures(UCultureTypes types) // ICU4N: Renamed from GetAvailableLocales
 {
     return(GetCultures(types, (id) => LocaleUtility.GetLocaleFromName(id)));
 }