MCPcopy Index your code
hub / github.com/GregTech6/gregtech6 / add

Method add

src/main/java/gregapi/lang/LanguageHandler.java:67–95  ·  view source on GitHub ↗
(String aKey, String aEnglish)

Source from the content-addressed store, hash-verified

65 }
66
67 public static synchronized void add(String aKey, String aEnglish) {
68 if (aKey == null) return;
69 aKey = aKey.trim();
70 if (aKey.length() <= 0) return;
71 boolean tSave = F;
72 BACKUPMAP.put(aKey, aEnglish);
73 if (sLangFile == null) {
74 BUFFERMAP.put(aKey, aEnglish);
75 } else {
76 if (!BUFFERMAP.isEmpty()) {
77 tSave = T;
78 for (Entry<String, String> tEntry : BUFFERMAP.entrySet()) {
79 Property tProperty = sLangFile.get("LanguageFile", tEntry.getKey(), tEntry.getValue());
80 TEMPMAP.put(tEntry.getKey() , sUseFile?tProperty.getString():tEntry.getValue());
81 TEMPMAP.put(tEntry.getKey()+".name", sUseFile?tProperty.getString():tEntry.getValue());
82 LanguageRegistry.instance().injectLanguage("en_US", TEMPMAP);
83 TEMPMAP.clear();
84 }
85 BUFFERMAP.clear();
86 }
87 Property tProperty = sLangFile.get("LanguageFile", aKey, aEnglish);
88 tSave |= tProperty.wasRead();
89 TEMPMAP.put(aKey , sUseFile?tProperty.getString():aEnglish);
90 TEMPMAP.put(aKey+".name", sUseFile?tProperty.getString():aEnglish);
91 LanguageRegistry.instance().injectLanguage("en_US", TEMPMAP);
92 TEMPMAP.clear();
93 }
94 if (tSave && mWritingEnabled) sLangFile.save();
95 }
96
97 public static String get(String aKey, String aDefault) {
98 add(aKey, aDefault);

Callers 2

getMethod · 0.95
addMethod · 0.95

Calls 5

getMethod · 0.65
putMethod · 0.45
isEmptyMethod · 0.45
clearMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected