From 82b30e12280885fa7293e19c699f0bfa17a6de52 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 16 Feb 2016 21:00:03 -0500 Subject: [PATCH] v0.3.4a: fixed an issue where turkish devices were seeing string errors this was due to the turkish non-dotted i being inserted when strings were being converted to lowercase, specifying the locale should fix this. --- .../shatteredpixel/shatteredpixeldungeon/Rankings.java | 3 ++- .../shatteredpixeldungeon/messages/Messages.java | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index e286181b2..ea31ce193 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -47,6 +47,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.Locale; public enum Rankings { @@ -231,7 +232,7 @@ public enum Rankings { //conversion logic for pre-0.3.4 saves if (bundle.contains( REASON )){ - String info = bundle.getString( REASON ).toLowerCase(); + String info = bundle.getString( REASON ).toLowerCase(Locale.ENGLISH); if (info.equals("obtained the amulet of yendor")) cause = Amulet.class; else if (info.contains("goo")) cause = Goo.class; else if (info.contains("tengu")) cause = Tengu.class; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java b/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java index d15ab2dbc..413c41ffb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java @@ -119,7 +119,7 @@ public class Messages { } else key = k; - if (!strings.containsKey(key.toLowerCase())){ + if (strings.containsKey(key.toLowerCase(Locale.ENGLISH))){ //this is so child classes can inherit properties from their parents. //in cases where text is commonly grabbed as a utility from classes that aren't mean to be instantiated //(e.g. flavourbuff.dispTurns()) using .class directly is probably smarter to prevent unnecessary recursive calls. @@ -129,8 +129,8 @@ public class Messages { return "!!!NO TEXT FOUND!!!"; } } else { - if (args.length > 0) return format(strings.get(key.toLowerCase()), args); - else return strings.get(key.toLowerCase()); + if (args.length > 0) return format(strings.get(key.toLowerCase(Locale.ENGLISH)), args); + else return strings.get(key.toLowerCase(Locale.ENGLISH)); } } @@ -164,7 +164,7 @@ public class Messages { String result = ""; //split by any unicode space character for (String word : str.split("(?<=\\p{Zs})")){ - if (noCaps.contains(word.trim().toLowerCase().replaceAll(":|[0-9]", ""))){ + if (noCaps.contains(word.trim().toLowerCase(Locale.ENGLISH).replaceAll(":|[0-9]", ""))){ result += word; } else { result += capitalize(word);