mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Speed up compilation when locales are not used
This commit is contained in:
parent
b94d711732
commit
54e0c43fb2
|
@ -100,6 +100,7 @@
|
|||
<argument>java.lang.reflect</argument>
|
||||
<argument>java.io</argument>
|
||||
<argument>java.net</argument>
|
||||
<argument>java.text</argument>
|
||||
<argument>java.util</argument>
|
||||
<argument>java.util.logging</argument>
|
||||
<argument>java.util.concurrent</argument>
|
||||
|
|
|
@ -38,11 +38,22 @@ public class CLDRReader {
|
|||
private Set<String> availableLocales = new LinkedHashSet<>();
|
||||
private Set<String> availableLanguages = new LinkedHashSet<>();
|
||||
private Set<String> availableCountries = new LinkedHashSet<>();
|
||||
private boolean initialized;
|
||||
private Properties properties;
|
||||
private ClassLoader classLoader;
|
||||
|
||||
public CLDRReader(Properties properties, ClassLoader classLoader) {
|
||||
this.properties = properties;
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
private synchronized void ensureInitialized() {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
findAvailableLocales(properties);
|
||||
readCLDR(classLoader);
|
||||
}
|
||||
}
|
||||
|
||||
private void findAvailableLocales(Properties properties) {
|
||||
String availableLocalesString = properties.getProperty("java.util.Locale.available", "en_EN").trim();
|
||||
|
@ -278,30 +289,37 @@ public class CLDRReader {
|
|||
}
|
||||
|
||||
public Map<String, CLDRLocale> getKnownLocales() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableMap(knownLocales);
|
||||
}
|
||||
|
||||
public Set<String> getAvailableLocales() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableSet(availableLocales);
|
||||
}
|
||||
|
||||
public Set<String> getAvailableLanguages() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableSet(availableLanguages);
|
||||
}
|
||||
|
||||
public Set<String> getAvailableCountries() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableSet(availableCountries);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getMinDaysMap() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableMap(minDaysMap);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getFirstDayMap() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableMap(firstDayMap);
|
||||
}
|
||||
|
||||
public Map<String, String> getLikelySubtags() {
|
||||
ensureInitialized();
|
||||
return Collections.unmodifiableMap(likelySubtags);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user