|
|
@ -13,8 +13,8 @@ import java.util.Locale; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class BidiUtils { |
|
|
|
public class BidiUtils { |
|
|
|
|
|
|
|
|
|
|
|
private static final Locale ar = new Locale("ar", "SA"); |
|
|
|
//private static final Locale ar = new Locale("ar", "SA");
|
|
|
|
private static final Locale cn = Locale.CHINA; |
|
|
|
private static final Locale ar = Locale.CHINA; |
|
|
|
|
|
|
|
|
|
|
|
private BidiUtils() { |
|
|
|
private BidiUtils() { |
|
|
|
} |
|
|
|
} |
|
|
@ -42,4 +42,18 @@ public class BidiUtils { |
|
|
|
public static boolean rtl() { |
|
|
|
public static boolean rtl() { |
|
|
|
return ComponentOrientation.getOrientation(ar) == ComponentOrientation.RIGHT_TO_LEFT; |
|
|
|
return ComponentOrientation.getOrientation(ar) == ComponentOrientation.RIGHT_TO_LEFT; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static String reverseConcatenateStrings(String... strs) { |
|
|
|
|
|
|
|
StringBuilder result = new StringBuilder(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rtl()) { |
|
|
|
|
|
|
|
for (int i = strs.length - 1; i >= 0; i--) { |
|
|
|
|
|
|
|
result.append(strs[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
for (int i = 0; i <= strs.length - 1; i++) { |
|
|
|
|
|
|
|
result.append(strs[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|