public void Constructor() { LocaleDataSource localeDataSource; localeDataSource = new LocaleDataSource(); Assert.IsNotNull(localeDataSource); }
private LocaleDataSource GetLocaleDataSource(Boolean refresh) { if (_localeDataSource.IsNull() || refresh) { _localeDataSource = new LocaleDataSource(); } return(_localeDataSource); }
public void DataSource() { ILocaleDataSource dataSource; dataSource = null; GetLocaleManager(true).DataSource = dataSource; Assert.AreEqual(dataSource, GetLocaleManager().DataSource); dataSource = new LocaleDataSource(); GetLocaleManager(true).DataSource = dataSource; Assert.AreEqual(dataSource, GetLocaleManager().DataSource); }
/** * Determine whether a locale has a mapping for a given text handle. Only tests the specified locale and form; does * not fallback to any default locale or text form. * * @param locale Locale. Must be defined and not null. * @param textID Text handle. * @return True if a mapping exists for the text handle in the given locale. * @throws UnregisteredLocaleException If locale is not defined. */ public Boolean hasMapping(String locale, String textID) { if (locale == null || !locales.Contains(locale)) { throw new UnregisteredLocaleException("Attempted to access an undefined locale (" + locale + ") while checking for a mapping for " + textID); } ArrayList resources = (ArrayList)localeResources[locale]; for (IEnumerator en = resources.GetEnumerator(); en.MoveNext();) { LocaleDataSource source = (LocaleDataSource)en.Current; if (source.getLocalizedText().ContainsKey(textID)) { return(true); } } return(false); }
/// <summary> Determine whether a locale has a mapping for a given text handle. Only tests the specified locale and form; does /// not fallback to any default locale or text form. /// /// </summary> /// <param name="locale">Locale. Must be defined and not null. /// </param> /// <param name="textID">Text handle. /// </param> /// <returns> True if a mapping exists for the text handle in the given locale. /// </returns> /// <throws> UnregisteredLocaleException If locale is not defined. </throws> public virtual bool hasMapping(System.String locale, System.String textID) { if (locale == null || !locales.contains(locale)) { throw new UnregisteredLocaleException("Attempted to access an undefined locale (" + locale + ") while checking for a mapping for " + textID); } System.Collections.ArrayList resources = (System.Collections.ArrayList) localeResources.get_Renamed(locale); //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'" for (System.Collections.IEnumerator en = resources.GetEnumerator(); en.MoveNext(); ) { //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'" LocaleDataSource source = (LocaleDataSource) en.Current; if (source.getLocalizedText().containsKey(textID)) { return true; } } return false; }
/* === MANAGING LOCALE DATA (TEXT MAPPINGS) === */ /// <summary> Registers a resource file as a source of locale data for the specified /// locale. /// /// </summary> /// <param name="locale">The locale of the definitions provided. /// </param> /// <param name="resource">A LocaleDataSource containing string data for the locale provided /// </param> /// <throws> NullPointerException if resource or locale are null </throws> public virtual void registerLocaleResource(System.String locale, LocaleDataSource resource) { if (locale == null) { throw new System.NullReferenceException("Attempt to register a data source to a null locale in the localizer"); } if (resource == null) { throw new System.NullReferenceException("Attempt to register a null data source in the localizer"); } List< LocaleDataSource > resources = new List< LocaleDataSource >(); if (localeResources.containsKey(locale)) { resources = localeResources.get_Renamed(locale); } resources.addElement(resource); localeResources.put(locale, resources); if (locale.Equals(currentLocale) || locale.Equals(defaultLocale)) { loadCurrentLocaleResources(); } }
/* === MANAGING LOCALE DATA (TEXT MAPPINGS) === */ /** * Registers a resource file as a source of locale data for the specified * locale. * * @param locale The locale of the definitions provided. * @param resource A LocaleDataSource containing string data for the locale provided * @throws NullPointerException if resource or locale are null */ public void registerLocaleResource(String locale, LocaleDataSource resource) { if (locale == null) { throw new NullReferenceException("Attempt to register a data source to a null locale in the localizer"); } if (resource == null) { throw new NullReferenceException("Attempt to register a null data source in the localizer"); } ArrayList resources = new ArrayList(); if (localeResources.ContainsKey(locale)) { resources = (ArrayList)localeResources[locale]; } resources.Add(resource); localeResources.put(locale, resources); if (locale.Equals(currentLocale)) { loadCurrentLocaleResources(); } }
public LocaleDataSourceTest() { _localeDataSource = null; }