Sorta revert 908491d5e7ac26becdac938f38cc90d6b9d73ce1 but merge assets

into the map, rather than force overwriting. Fixes skyboy's comment.
This commit is contained in:
cpw 2014-07-20 10:46:22 -04:00
parent 4ba024ca2e
commit 5643237fb9
2 changed files with 21 additions and 10 deletions

View file

@ -9,11 +9,11 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.IOException;
@@ -82,6 +84,7 @@
arraylist.add(this.field_135048_c);
@@ -83,6 +85,7 @@
}
+ LanguageRegistry.instance().loadLanguageTable(field_135049_a.field_135032_a, this.field_135048_c);
field_135049_a.func_135022_a(p_110549_1_, arraylist);
+ LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c);
StringTranslate.func_135063_a(field_135049_a.field_135032_a);
}

View file

@ -21,6 +21,7 @@ import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -153,19 +154,29 @@ public class LanguageRegistry
*/
@SuppressWarnings("unchecked")
@Deprecated
public void loadLanguageTable(@SuppressWarnings("rawtypes") Map field_135032_a, String lang)
public void mergeLanguageTable(@SuppressWarnings("rawtypes") Map field_135032_a, String lang)
{
Properties langPack=modLanguageData.get(lang);
if (langPack!=null) {
mergeWithoutOverwrite(langPack, field_135032_a);
}
Properties usPack=modLanguageData.get("en_US");
if (usPack!=null) {
field_135032_a.putAll(usPack);
mergeWithoutOverwrite(usPack, field_135032_a);
}
Properties langPack=modLanguageData.get(lang);
if (langPack==null) {
return;
}
field_135032_a.putAll(langPack);
}
@Deprecated
private <K, V> void mergeWithoutOverwrite(Map<? extends K,? extends V> from, Map<K, V> to)
{
for (Entry<? extends K, ? extends V> e : from.entrySet())
{
if (!to.containsKey(e.getKey()))
{
to.put(e.getKey(),e.getValue());
}
}
}
/**
* Deprecated for removal in 1.8. Use the assets lang system
*/