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.
This commit is contained in:
Evan Debenham 2016-02-16 21:00:03 -05:00
parent 2c82a94ffc
commit 82b30e1228
2 changed files with 6 additions and 5 deletions

View File

@ -47,6 +47,7 @@ import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Locale;
public enum Rankings { public enum Rankings {
@ -231,7 +232,7 @@ public enum Rankings {
//conversion logic for pre-0.3.4 saves //conversion logic for pre-0.3.4 saves
if (bundle.contains( REASON )){ 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; if (info.equals("obtained the amulet of yendor")) cause = Amulet.class;
else if (info.contains("goo")) cause = Goo.class; else if (info.contains("goo")) cause = Goo.class;
else if (info.contains("tengu")) cause = Tengu.class; else if (info.contains("tengu")) cause = Tengu.class;

View File

@ -119,7 +119,7 @@ public class Messages {
} else } else
key = k; 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. //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 //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. //(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!!!"; return "!!!NO TEXT FOUND!!!";
} }
} else { } else {
if (args.length > 0) return format(strings.get(key.toLowerCase()), args); if (args.length > 0) return format(strings.get(key.toLowerCase(Locale.ENGLISH)), args);
else return strings.get(key.toLowerCase()); else return strings.get(key.toLowerCase(Locale.ENGLISH));
} }
} }
@ -164,7 +164,7 @@ public class Messages {
String result = ""; String result = "";
//split by any unicode space character //split by any unicode space character
for (String word : str.split("(?<=\\p{Zs})")){ 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; result += word;
} else { } else {
result += capitalize(word); result += capitalize(word);