aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/util/GT_LanguageManager.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java
index 12e39eb774..b1bd45476a 100644
--- a/src/main/java/gregtech/api/util/GT_LanguageManager.java
+++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java
@@ -37,6 +37,11 @@ public class GT_LanguageManager {
*/
public static Configuration sEnglishFile;
/**
+ * If the game is running with en_US language. This does not get updated when user changes language in game;
+ * GT lang system cannot handle that anyway.
+ */
+ public static boolean isEN_US;
+ /**
* If placeholder like %material should be used for writing lang entries to file.
*/
public static boolean i18nPlaceholder = true;
@@ -125,14 +130,25 @@ public class GT_LanguageManager {
sEnglishFile.save();
hasUnsavedEntry = false;
}
- if (!tProperty.wasRead()) {
- if (GregTech_API.sPostloadFinished) {
- sEnglishFile.save();
- } else {
- hasUnsavedEntry = true;
+ String translation = tProperty.getString();
+ if (tProperty.wasRead()) {
+ if (isEN_US && !aEnglish.equals(translation)) {
+ tProperty.set(aEnglish);
+ markFileDirty();
+ return aEnglish;
}
+ } else {
+ markFileDirty();
+ }
+ return translation;
+ }
+
+ private static synchronized void markFileDirty() {
+ if (GregTech_API.sPostloadFinished) {
+ sEnglishFile.save();
+ } else {
+ hasUnsavedEntry = true;
}
- return tProperty.getString();
}
public static String getTranslation(String aKey) {