Skip to content

Commit 95beb0e

Browse files
committed
Debugged previous commit
Added code for finding the English vanilla bundles file.
1 parent 3d49d2c commit 95beb0e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/bundles/BundleTranslations.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,27 @@ public class BundleTranslations extends HashMap<String, LinkedHashMap<String, St
2626
public BundleTranslations() throws NonEnglishVanillaBundlesFileException {
2727
// Populate /this/ with hashmaps of bundle name translations for every language
2828
for (String[] lang: langs) {
29+
boolean isEnglish = lang[0].equals("en");
2930
// Initialise hashmap
3031
LinkedHashMap<String, String> translations;
3132
// Populate hashmap
3233
translations = new LinkedHashMap<String, String>();
3334
// Read the bundles file for the current language
34-
ReadableJsonFile readableBundlesFile = new ReadableJsonFile("Bundles/Vanilla", "Bundles." + lang[0] + "-" + lang[1]);
35+
ReadableJsonFile readableBundlesFile = (
36+
isEnglish?
37+
new ReadableJsonFile("Bundles/Vanilla", "Bundles"):
38+
new ReadableJsonFile("Bundles/Vanilla", "Bundles." + lang[0] + "-" + lang[1])
39+
);
3540
try {
3641
try {
3742
JsonObject bundles = readableBundlesFile.getJson();
3843
// Add bundleEnglishName -> bundleLangName entries
3944
for (Entry<String, JsonElement> bundleEntry: bundles.entrySet()) {
45+
String bundleName = getName(readableBundlesFile, bundleEntry);
4046
translations.put(
41-
getName(readableBundlesFile, bundleEntry), (
42-
lang[0].equals("en")?
43-
getName(readableBundlesFile, bundleEntry):
47+
bundleName, (
48+
isEnglish?
49+
bundleName:
4450
getNameTranslation(readableBundlesFile, bundleEntry)
4551
)
4652
);

0 commit comments

Comments
 (0)