aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt9
2 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java
index b62c88efc..6daf37cfd 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DevConfig.java
@@ -109,6 +109,13 @@ public class DevConfig {
public boolean fancySbaContributors = false;
@Expose
+ @ConfigOption(
+ name = "Number Format Override",
+ desc = "Forces the number format to use the en_US locale.")
+ @ConfigEditorBoolean
+ public boolean numberFormatOverride = false;
+
+ @Expose
@Category(name = "Minecraft Console", desc = "Minecraft Console Settings")
public MinecraftConsoleConfig minecraftConsoles = new MinecraftConsoleConfig();
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index b97298ce4..4d5fe0a1d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -1,14 +1,18 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.utils.LorenzUtils.round
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import java.text.NumberFormat
+import java.util.Locale
import java.util.TreeMap
import kotlin.math.pow
import kotlin.math.roundToInt
object NumberUtil {
+ private val config get() = SkyHanniMod.feature
+
private val suffixes = TreeMap<Long, String>().apply {
this[1000L] = "k"
this[1000000L] = "M"
@@ -109,7 +113,10 @@ object NumberUtil {
return this.toString() + this.ordinal()
}
- fun Number.addSeparators() = NumberFormat.getNumberInstance().format(this)
+ fun Number.addSeparators(): String {
+ return if (!config.dev.numberFormatOverride) NumberFormat.getNumberInstance().format(this)
+ else NumberFormat.getNumberInstance(Locale.US).format(this)
+ }
fun String.romanToDecimalIfNecessary() = toIntOrNull() ?: romanToDecimal()