aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/config
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-26 02:46:10 +0200
committerGitHub <noreply@github.com>2024-08-26 02:46:10 +0200
commita658f0f272c25d50ce3c572c388e07895735bd48 (patch)
treeb5bb0e3a8891e5cffe31d60ff3978a7653c99df8 /src/main/java/at/hannibal2/skyhanni/config
parent290676ba3954d653bc1cbc0630d2cde90a3249f4 (diff)
downloadskyhanni-a658f0f272c25d50ce3c572c388e07895735bd48.tar.gz
skyhanni-a658f0f272c25d50ce3c572c388e07895735bd48.tar.bz2
skyhanni-a658f0f272c25d50ce3c572c388e07895735bd48.zip
Improvement: Multiple Languages (#2403)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/chat/TranslatorConfig.java37
4 files changed, 42 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
index 25cab54fb..6d045d56a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
@@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {
val logger = LorenzLogger("ConfigMigration")
- const val CONFIG_VERSION = 54
+ const val CONFIG_VERSION = 55
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index 50accf32c..fbd93a4d8 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.data.TitleManager
import at.hannibal2.skyhanni.data.bazaar.HypixelBazaarFetcher
import at.hannibal2.skyhanni.features.bingo.card.BingoCardDisplay
import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper
-import at.hannibal2.skyhanni.features.chat.Translator
+import at.hannibal2.skyhanni.features.chat.translation.Translator
import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker
import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil
import at.hannibal2.skyhanni.features.commands.HelpCommand
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java
index f9e64f1e0..6a1d129a2 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.config.features.chat;
import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.Accordion;
+import io.github.notenoughupdates.moulconfig.annotations.Category;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorKeybind;
@@ -104,16 +105,9 @@ public class ChatConfig {
@FeatureToggle
public boolean hideSacksChange = false;
+ @Category(name = "Translator", desc = "Chat translator settings.")
@Expose
- @ConfigOption(
- name = "Translator",
- desc = "Click on a message to translate it to English.\n" +
- "Use §e/shcopytranslation§7 to translate from English.\n" +
- "§cTranslation is not guaranteed to be 100% accurate."
- )
- @ConfigEditorBoolean
- @FeatureToggle
- public boolean translator = false;
+ public TranslatorConfig translator = new TranslatorConfig();
@Expose
@ConfigOption(name = "SkyBlock XP in Chat", desc = "Send the SkyBlock XP messages into the chat.")
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/TranslatorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/TranslatorConfig.java
new file mode 100644
index 000000000..648afbd87
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/TranslatorConfig.java
@@ -0,0 +1,37 @@
+package at.hannibal2.skyhanni.config.features.chat;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import at.hannibal2.skyhanni.features.chat.translation.TranslatableLanguage;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+import io.github.notenoughupdates.moulconfig.observer.Property;
+
+public class TranslatorConfig {
+
+ @Expose
+ @ConfigOption(
+ name = "Translate On Click",
+ desc = "Click on a message to translate it to English.\n" +
+ "Use §e/shcopytranslation§7 to translate from English.\n" +
+ "§cTranslation is not guaranteed to be 100% accurate."
+ )
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean translateOnClick = false;
+
+ @ConfigOption(name = "Language Name", desc = "The name of the language selected below. Note that languages marked as unknown might still be supported.")
+ @Expose
+ @ConfigEditorDropdown
+ public Property<TranslatableLanguage> languageName = Property.of(TranslatableLanguage.ENGLISH);
+
+ @Expose
+ @ConfigOption(
+ name = "Language Code",
+ desc = "Enter a language code here to translate on chat click into another language. " +
+ "E.g. `es` for spanish or 'de' for german. Empty for english.")
+ @ConfigEditorText
+ public Property<String> languageCode = Property.of("en");
+}