[#1359] Remove fixed US locale
* [#1359]: Use default Locale in PercentDecimal * Intended use of Local.US * Use default Locale in Transaction history dates * Use default Locale in Balance widget * Use default Locale in Send tests * Use default Locale in WalletDisplayValues.kt
This commit is contained in:
parent
cada044991
commit
e92c0b613c
|
@ -251,6 +251,7 @@ androidComponents {
|
||||||
".readme",
|
".readme",
|
||||||
))
|
))
|
||||||
|
|
||||||
|
// The fixed Locale.US is intended
|
||||||
if (variant.name.lowercase(Locale.US).contains("release")) {
|
if (variant.name.lowercase(Locale.US).contains("release")) {
|
||||||
variant.packaging.resources.excludes.addAll(listOf(
|
variant.packaging.resources.excludes.addAll(listOf(
|
||||||
"**/*.kotlin_metadata",
|
"**/*.kotlin_metadata",
|
||||||
|
|
|
@ -33,7 +33,7 @@ class PercentDecimalExtTest {
|
||||||
runTest {
|
runTest {
|
||||||
val parsed = PercentDecimal(1f).toPercentageWithDecimal()
|
val parsed = PercentDecimal(1f).toPercentageWithDecimal()
|
||||||
|
|
||||||
assertEquals("100${MonetarySeparators.current(Locale.US).decimal}00", parsed)
|
assertEquals("100${MonetarySeparators.current(Locale.getDefault()).decimal}00", parsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -16,9 +16,7 @@ fun PercentDecimal.toPercentageWithDecimal(decimalFormat: DecimalFormat = prepar
|
||||||
|
|
||||||
private fun preparePercentDecimalFormat(): DecimalFormat =
|
private fun preparePercentDecimalFormat(): DecimalFormat =
|
||||||
DecimalFormat().apply {
|
DecimalFormat().apply {
|
||||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
|
||||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
|
||||||
val monetarySeparators = MonetarySeparators.current(Locale.US)
|
|
||||||
val localizedPattern = "##0${monetarySeparators.decimal}00"
|
val localizedPattern = "##0${monetarySeparators.decimal}00"
|
||||||
runCatching {
|
runCatching {
|
||||||
applyLocalizedPattern(localizedPattern)
|
applyLocalizedPattern(localizedPattern)
|
||||||
|
|
|
@ -375,8 +375,8 @@ private fun splitBalance(
|
||||||
): Pair<String, String> {
|
): Pair<String, String> {
|
||||||
Twig.debug { "Balance before split: $balance, prefix: $prefix" }
|
Twig.debug { "Balance before split: $balance, prefix: $prefix" }
|
||||||
|
|
||||||
@Suppress("MAGIC_CONSTANT", "MagicNumber")
|
@Suppress("MagicNumber")
|
||||||
val cutPosition = balance.indexOf(MonetarySeparators.current(Locale.US).decimal) + 4
|
val cutPosition = balance.indexOf(MonetarySeparators.current(Locale.getDefault()).decimal) + 4
|
||||||
val firstPart =
|
val firstPart =
|
||||||
(prefix ?: "") +
|
(prefix ?: "") +
|
||||||
balance.substring(
|
balance.substring(
|
||||||
|
|
|
@ -79,9 +79,7 @@ class SendViewTestSetup(
|
||||||
fun DefaultContent() {
|
fun DefaultContent() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
|
||||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
|
||||||
val monetarySeparators = MonetarySeparators.current(Locale.US)
|
|
||||||
|
|
||||||
val (sendStage, setSendStage) =
|
val (sendStage, setSendStage) =
|
||||||
rememberSaveable(stateSaver = SendStage.Saver) { mutableStateOf(initialState) }
|
rememberSaveable(stateSaver = SendStage.Saver) { mutableStateOf(initialState) }
|
||||||
|
|
|
@ -51,9 +51,7 @@ class SendViewIntegrationTest {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
private val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
|
||||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
|
||||||
private val monetarySeparators = MonetarySeparators.current(Locale.US)
|
|
||||||
|
|
||||||
// TODO [#1260]: Cover Send screens UI with tests
|
// TODO [#1260]: Cover Send screens UI with tests
|
||||||
// TODO [#1260]: https://github.com/Electric-Coin-Company/zashi-android/issues/1260
|
// TODO [#1260]: https://github.com/Electric-Coin-Company/zashi-android/issues/1260
|
||||||
|
|
|
@ -98,12 +98,10 @@ private fun ComposableHistoryListPreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
|
||||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
|
||||||
private val dateFormat: DateFormat by lazy {
|
private val dateFormat: DateFormat by lazy {
|
||||||
SimpleDateFormat(
|
SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss",
|
"yyyy-MM-dd HH:mm:ss",
|
||||||
Locale.US
|
Locale.getDefault()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,7 @@ data class WalletDisplayValues(
|
||||||
walletSnapshot.spendableBalance().toFiatCurrencyState(
|
walletSnapshot.spendableBalance().toFiatCurrencyState(
|
||||||
null,
|
null,
|
||||||
Locale.current.toKotlinLocale(),
|
Locale.current.toKotlinLocale(),
|
||||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
MonetarySeparators.current(java.util.Locale.getDefault())
|
||||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
|
||||||
MonetarySeparators.current(java.util.Locale.US)
|
|
||||||
)
|
)
|
||||||
var fiatCurrencyAmountText = getFiatCurrencyRateValue(context, fiatCurrencyAmountState)
|
var fiatCurrencyAmountText = getFiatCurrencyRateValue(context, fiatCurrencyAmountState)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ internal sealed class ParseResult {
|
||||||
completeWordList: Set<String>,
|
completeWordList: Set<String>,
|
||||||
rawInput: String
|
rawInput: String
|
||||||
): ParseResult {
|
): ParseResult {
|
||||||
// Note: This assumes the word list is English words
|
// Note: This assumes the word list is English words, thus the Locale.US is intended.
|
||||||
val trimmed = rawInput.lowercase(Locale.US).trim()
|
val trimmed = rawInput.lowercase(Locale.US).trim()
|
||||||
|
|
||||||
if (trimmed.isBlank()) {
|
if (trimmed.isBlank()) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ data class TimeInfo(
|
||||||
fun toSupportString() =
|
fun toSupportString() =
|
||||||
buildString {
|
buildString {
|
||||||
// Use a slightly more human friendly format instead of ISO, since this will appear in the emails that
|
// Use a slightly more human friendly format instead of ISO, since this will appear in the emails that
|
||||||
// users see
|
// users see. The fixed Locale.US is intended.
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd hh:mm:ss a", Locale.US) // $NON-NLS-1$
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd hh:mm:ss a", Locale.US) // $NON-NLS-1$
|
||||||
|
|
||||||
appendLine("Current time: ${dateFormat.formatInstant(currentTime)}")
|
appendLine("Current time: ${dateFormat.formatInstant(currentTime)}")
|
||||||
|
|
Loading…
Reference in New Issue