[#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",
|
||||
))
|
||||
|
||||
// The fixed Locale.US is intended
|
||||
if (variant.name.lowercase(Locale.US).contains("release")) {
|
||||
variant.packaging.resources.excludes.addAll(listOf(
|
||||
"**/*.kotlin_metadata",
|
||||
|
|
|
@ -33,7 +33,7 @@ class PercentDecimalExtTest {
|
|||
runTest {
|
||||
val parsed = PercentDecimal(1f).toPercentageWithDecimal()
|
||||
|
||||
assertEquals("100${MonetarySeparators.current(Locale.US).decimal}00", parsed)
|
||||
assertEquals("100${MonetarySeparators.current(Locale.getDefault()).decimal}00", parsed)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -16,9 +16,7 @@ fun PercentDecimal.toPercentageWithDecimal(decimalFormat: DecimalFormat = prepar
|
|||
|
||||
private fun preparePercentDecimalFormat(): DecimalFormat =
|
||||
DecimalFormat().apply {
|
||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
||||
val monetarySeparators = MonetarySeparators.current(Locale.US)
|
||||
val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
|
||||
val localizedPattern = "##0${monetarySeparators.decimal}00"
|
||||
runCatching {
|
||||
applyLocalizedPattern(localizedPattern)
|
||||
|
|
|
@ -375,8 +375,8 @@ private fun splitBalance(
|
|||
): Pair<String, String> {
|
||||
Twig.debug { "Balance before split: $balance, prefix: $prefix" }
|
||||
|
||||
@Suppress("MAGIC_CONSTANT", "MagicNumber")
|
||||
val cutPosition = balance.indexOf(MonetarySeparators.current(Locale.US).decimal) + 4
|
||||
@Suppress("MagicNumber")
|
||||
val cutPosition = balance.indexOf(MonetarySeparators.current(Locale.getDefault()).decimal) + 4
|
||||
val firstPart =
|
||||
(prefix ?: "") +
|
||||
balance.substring(
|
||||
|
|
|
@ -79,9 +79,7 @@ class SendViewTestSetup(
|
|||
fun DefaultContent() {
|
||||
val context = LocalContext.current
|
||||
|
||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
||||
val monetarySeparators = MonetarySeparators.current(Locale.US)
|
||||
val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
|
||||
|
||||
val (sendStage, setSendStage) =
|
||||
rememberSaveable(stateSaver = SendStage.Saver) { mutableStateOf(initialState) }
|
||||
|
|
|
@ -51,9 +51,7 @@ class SendViewIntegrationTest {
|
|||
)
|
||||
)
|
||||
|
||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
||||
private val monetarySeparators = MonetarySeparators.current(Locale.US)
|
||||
private val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
|
||||
|
||||
// TODO [#1260]: Cover Send screens UI with tests
|
||||
// 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 {
|
||||
SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss",
|
||||
Locale.US
|
||||
Locale.getDefault()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,7 @@ data class WalletDisplayValues(
|
|||
walletSnapshot.spendableBalance().toFiatCurrencyState(
|
||||
null,
|
||||
Locale.current.toKotlinLocale(),
|
||||
// TODO [#1171]: Remove default MonetarySeparators locale
|
||||
// TODO [#1171]: https://github.com/Electric-Coin-Company/zashi-android/issues/1171
|
||||
MonetarySeparators.current(java.util.Locale.US)
|
||||
MonetarySeparators.current(java.util.Locale.getDefault())
|
||||
)
|
||||
var fiatCurrencyAmountText = getFiatCurrencyRateValue(context, fiatCurrencyAmountState)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ internal sealed class ParseResult {
|
|||
completeWordList: Set<String>,
|
||||
rawInput: String
|
||||
): 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()
|
||||
|
||||
if (trimmed.isBlank()) {
|
||||
|
|
|
@ -23,7 +23,7 @@ data class TimeInfo(
|
|||
fun toSupportString() =
|
||||
buildString {
|
||||
// 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$
|
||||
|
||||
appendLine("Current time: ${dateFormat.formatInstant(currentTime)}")
|
||||
|
|
Loading…
Reference in New Issue