LocaleUtil treat empty currency as RUB
This commit is contained in:
parent
39f9544cfb
commit
b415d22caf
2 changed files with 10 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ public class LocaleUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Locale locale(Account acc) {
|
public static Locale locale(Account acc) {
|
||||||
if (CurrencyCode.isRub(acc.getCurrency())) {
|
if (CurrencyCode.isRubDefault(acc.getCurrency())) {
|
||||||
return ru;
|
return ru;
|
||||||
} else {
|
} else {
|
||||||
return eng;
|
return eng;
|
||||||
|
|
@ -22,10 +22,10 @@ public class LocaleUtil {
|
||||||
|
|
||||||
public static Locale locale(String... currencyCode) {
|
public static Locale locale(String... currencyCode) {
|
||||||
for (String s : currencyCode) {
|
for (String s : currencyCode) {
|
||||||
if (CurrencyCode.isRub(s)) {
|
if (!CurrencyCode.isRubDefault(s)) {
|
||||||
return ru;
|
return eng;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return eng;
|
return ru;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package ru.spcex.platform.enumeration;
|
package ru.spcex.platform.enumeration;
|
||||||
|
|
||||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||||
|
import ru.spcex.platform.utils.text.TextUtil;
|
||||||
|
|
||||||
public enum CurrencyCode implements IEnumKey {
|
public enum CurrencyCode implements IEnumKey {
|
||||||
RUB("RUB"),
|
RUB("RUB"),
|
||||||
|
|
@ -12,6 +13,11 @@ public enum CurrencyCode implements IEnumKey {
|
||||||
public static boolean isRub(String currencyCode) {
|
public static boolean isRub(String currencyCode) {
|
||||||
return IEnumKey.containsIgnoreCase(currencyCode, RUB, RUR, SUR);
|
return IEnumKey.containsIgnoreCase(currencyCode, RUB, RUR, SUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isRubDefault(String currencyCode) {
|
||||||
|
return TextUtil.isEmpty(currencyCode) || isRub(currencyCode);
|
||||||
|
}
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
|
|
||||||
CurrencyCode(String key) {
|
CurrencyCode(String key) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue