Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/serverutils/ServerUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ public static CommandException errorFeatureDisabledServer(@Nullable ICommandSend

@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent event) {
// Keep string handling on US English, mainly to avoid the Turkish dotless I breaking case conversions.
// Number and date formatting stays on the player's locale, other mods read it to format their own output.
final Locale formatLocale = Locale.getDefault(Locale.Category.FORMAT);
Locale.setDefault(Locale.US);
Locale.setDefault(Locale.Category.FORMAT, formatLocale);

PROXY.preInit(event);
}

Expand Down
11 changes: 9 additions & 2 deletions src/main/java/serverutils/lib/util/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import java.io.Reader;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -45,8 +47,13 @@ public class StringUtils {
.compareToIgnoreCase(getID(o2, FLAG_ID_FIX));

public static final Map<String, String> TEMP_MAP = new HashMap<>();
public static final DecimalFormat DOUBLE_FORMATTER_00 = new DecimalFormat("#0.00");
public static final DecimalFormat DOUBLE_FORMATTER_0 = new DecimalFormat("#0.0");
// Root locale, formatDouble0 and formatDouble00 trim the fraction by looking for a dot.
public static final DecimalFormat DOUBLE_FORMATTER_00 = new DecimalFormat(
"#0.00",
DecimalFormatSymbols.getInstance(Locale.ROOT));
public static final DecimalFormat DOUBLE_FORMATTER_0 = new DecimalFormat(
"#0.0",
DecimalFormatSymbols.getInstance(Locale.ROOT));
public final static int[] INT_SIZE_TABLE = { 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
Integer.MAX_VALUE };

Expand Down