return factory;
}
private static LocaleUtils createInstance(TreeLogger logger,
SelectionProperty localeProp, ConfigurationProperty prop) {
GwtLocale compileLocale = null;
Set<GwtLocale> allLocales = new HashSet<GwtLocale>();
Set<GwtLocale> allCompileLocales = new HashSet<GwtLocale>();
Set<GwtLocale> runtimeLocales = new HashSet<GwtLocale>();
String localeName = localeProp.getCurrentValue();
SortedSet<String> localeValues = localeProp.getPossibleValues();
GwtLocaleFactory factoryInstance = getLocaleFactory();
GwtLocale newCompileLocale = factoryInstance.fromString(localeName);
compileLocale = newCompileLocale;
for (String localeValue : localeValues) {
allCompileLocales.add(factoryInstance.fromString(localeValue));
}
allLocales.addAll(allCompileLocales);
List<String> rtLocaleNames = prop.getValues();
if (rtLocaleNames != null) {
for (String rtLocale : rtLocaleNames) {
GwtLocale locale = factoryInstance.fromString(rtLocale);
// TODO(jat): remove use of labels
existingLocales:
for (GwtLocale existing : allCompileLocales) {
for (GwtLocale alias : existing.getAliases()) {
if (!alias.isDefault() && locale.inheritsFrom(alias)
&& locale.usesSameScript(alias)) {
allLocales.add(locale);
break existingLocales;
}
}
}
if (!compileLocale.isDefault()
&& locale.inheritsFrom(compileLocale)
&& locale.usesSameScript(compileLocale)) {
// TODO(jat): don't include runtime locales which also inherit
// from a more-specific compile locale than this one
runtimeLocales.add(locale);
}
}