diff options
| author | 2025-09-03 13:59:45 +0300 | |
|---|---|---|
| committer | 2025-09-03 11:59:45 +0100 | |
| commit | 57c37c222c43f732c8b7703263cf9a573561322f (patch) | |
| tree | b1eda877bac461463448ec1def988810447193fc /enigma-swing/src/main/java | |
| parent | Update Gradle and fix buildscripts (#557) (diff) | |
| download | enigma-57c37c222c43f732c8b7703263cf9a573561322f.tar.gz enigma-57c37c222c43f732c8b7703263cf9a573561322f.tar.xz enigma-57c37c222c43f732c8b7703263cf9a573561322f.zip | |
Always specify locale in toUpperCase and toLowerCase (#556)
Not all of these changes are strictly needed to avoid the Turkish i issue
specifically, but it's good to be consistent.
Diffstat (limited to 'enigma-swing/src/main/java')
4 files changed, 8 insertions, 4 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java index dc58464c..6dd89572 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java | |||
| @@ -18,6 +18,7 @@ import java.nio.file.Path; | |||
| 18 | import java.nio.file.Paths; | 18 | import java.nio.file.Paths; |
| 19 | import java.util.EnumSet; | 19 | import java.util.EnumSet; |
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | import java.util.Locale; | ||
| 21 | import java.util.Set; | 22 | import java.util.Set; |
| 22 | 23 | ||
| 23 | import joptsimple.OptionException; | 24 | import joptsimple.OptionException; |
| @@ -143,7 +144,7 @@ public class Main { | |||
| 143 | 144 | ||
| 144 | if (Files.isDirectory(mappingsPath)) { | 145 | if (Files.isDirectory(mappingsPath)) { |
| 145 | controller.openMappings(MappingFormat.ENIGMA_DIRECTORY, mappingsPath); | 146 | controller.openMappings(MappingFormat.ENIGMA_DIRECTORY, mappingsPath); |
| 146 | } else if (mappingsPath.getFileName().toString().toLowerCase().endsWith(".zip")) { | 147 | } else if (mappingsPath.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".zip")) { |
| 147 | controller.openMappings(MappingFormat.ENIGMA_ZIP, mappingsPath); | 148 | controller.openMappings(MappingFormat.ENIGMA_ZIP, mappingsPath); |
| 148 | } else { | 149 | } else { |
| 149 | controller.openMappings(MappingFormat.ENIGMA_FILE, mappingsPath); | 150 | controller.openMappings(MappingFormat.ENIGMA_FILE, mappingsPath); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java index 9955a6b0..1d7082de 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java | |||
| @@ -5,6 +5,7 @@ import java.io.BufferedReader; | |||
| 5 | import java.lang.reflect.Type; | 5 | import java.lang.reflect.Type; |
| 6 | import java.nio.file.Files; | 6 | import java.nio.file.Files; |
| 7 | import java.nio.file.Path; | 7 | import java.nio.file.Path; |
| 8 | import java.util.Locale; | ||
| 8 | 9 | ||
| 9 | import com.google.gson.Gson; | 10 | import com.google.gson.Gson; |
| 10 | import com.google.gson.GsonBuilder; | 11 | import com.google.gson.GsonBuilder; |
| @@ -98,7 +99,7 @@ public class Config { | |||
| 98 | private static class IntSerializer implements JsonSerializer<Integer> { | 99 | private static class IntSerializer implements JsonSerializer<Integer> { |
| 99 | @Override | 100 | @Override |
| 100 | public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { | 101 | public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { |
| 101 | return new JsonPrimitive("#" + Integer.toHexString(src).toUpperCase()); | 102 | return new JsonPrimitive("#" + Integer.toHexString(src).toUpperCase(Locale.ROOT)); |
| 102 | } | 103 | } |
| 103 | } | 104 | } |
| 104 | 105 | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java index 05b7dfbe..657c58bd 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java | |||
| @@ -17,6 +17,7 @@ import java.awt.Dimension; | |||
| 17 | import java.awt.FlowLayout; | 17 | import java.awt.FlowLayout; |
| 18 | import java.awt.event.KeyAdapter; | 18 | import java.awt.event.KeyAdapter; |
| 19 | import java.awt.event.KeyEvent; | 19 | import java.awt.event.KeyEvent; |
| 20 | import java.util.Locale; | ||
| 20 | import java.util.Objects; | 21 | import java.util.Objects; |
| 21 | 22 | ||
| 22 | import javax.swing.JButton; | 23 | import javax.swing.JButton; |
| @@ -223,7 +224,7 @@ public class JavadocDialog { | |||
| 223 | } | 224 | } |
| 224 | 225 | ||
| 225 | public String getText() { | 226 | public String getText() { |
| 226 | return "@" + this.name().toLowerCase(); | 227 | return "@" + this.name().toLowerCase(Locale.ROOT); |
| 227 | } | 228 | } |
| 228 | 229 | ||
| 229 | public boolean isInline() { | 230 | public boolean isInline() { |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java index c11963df..27b8a6bb 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java | |||
| @@ -5,6 +5,7 @@ import java.awt.Font; | |||
| 5 | import java.awt.Insets; | 5 | import java.awt.Insets; |
| 6 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | import java.util.Locale; | ||
| 8 | import java.util.function.Predicate; | 9 | import java.util.function.Predicate; |
| 9 | 10 | ||
| 10 | import javax.swing.BorderFactory; | 11 | import javax.swing.BorderFactory; |
| @@ -98,7 +99,7 @@ public class ScaleUtil { | |||
| 98 | 99 | ||
| 99 | @SuppressWarnings("null") | 100 | @SuppressWarnings("null") |
| 100 | private static BasicTweaker createTweakerForCurrentLook(float dpiScaling) { | 101 | private static BasicTweaker createTweakerForCurrentLook(float dpiScaling) { |
| 101 | String testString = UIManager.getLookAndFeel().getName().toLowerCase(); | 102 | String testString = UIManager.getLookAndFeel().getName().toLowerCase(Locale.ROOT); |
| 102 | 103 | ||
| 103 | if (testString.contains("windows")) { | 104 | if (testString.contains("windows")) { |
| 104 | return new WindowsTweaker(dpiScaling, testString.contains("classic")) { | 105 | return new WindowsTweaker(dpiScaling, testString.contains("classic")) { |