commit 5f40cadfb306e8a82870880904d7cf127cb0f3d9
parent 32e5ffa8475bf357303d619cbc4cc3abb9cd95c3
Author: Iván Ávalos <avalos@disroot.org>
Date: Thu, 13 Jun 2024 08:44:11 -0600
dd51: document alt_unit_names_are_symbols
Diffstat:
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/design-documents/051-fractional-digits.rst b/design-documents/051-fractional-digits.rst
@@ -80,6 +80,10 @@ provisioned by all three services.
let fractional_normal_digits: Int
// usually same as fractionalNormalDigits, but e.g. might be 2 for ¥
let fractional_trailing_zero_digits: Int
+ // specifies whether the keys in `alt_unit_names' are symbols
+ // (e.g. €, k€) or names (e.g. BTC, mBTC), so that apps can decide
+ // how to render it (e.g. EUR 10 vs €10)
+ let alt_unit_names_are_symbols: Bool
// map of powers of 10 to alternative currency names / symbols,
// must always have an entry under "0" that defines the base name,
// e.g. "0 : €" or "3 : k€". For BTC, would be "0 : BTC, -3 : mBTC".
@@ -91,9 +95,6 @@ provisioned by all three services.
removed from this struct since they should always be taken from the user's
locale.)
-
-
-
For very large (2400000) or very tiny amounts (0.000056) the software would
then first represent the number compactly without any fraction (so for our
examples above, 24 * 10^6 and 56 * 10^-6) and then search for the nearest fit
@@ -121,6 +122,7 @@ section. The map could be given directly in JSON. For example:
fractional_input_digits = 2
fractional_normal_digits = 2
fractional_trailing_zero_digits = 2
+ alt_unit_names_are_symbols = YES
alt_unit_names = {"0":"€"}
[currency-japanese-yen]
@@ -130,6 +132,7 @@ section. The map could be given directly in JSON. For example:
fractional_input_digits = 2
fractional_normal_digits = 0
fractional_trailing_zero_digits = 2
+ alt_unit_names_are_symbols = YES
alt_unit_names = {"0":"¥"}
[currency-bitcoin-mainnet]
@@ -139,6 +142,7 @@ section. The map could be given directly in JSON. For example:
fractional_input_digits = 8
fractional_normal_digits = 3
fractional_trailing_zero_digits = 0
+ alt_unit_names_are_symbols = NO
alt_unit_names = {"0":"BTC","-3":"mBTC"}
[currency-ethereum]
@@ -148,6 +152,7 @@ section. The map could be given directly in JSON. For example:
fractional_input_digits = 0
fractional_normal_digits = 0
fractional_trailing_zero_digits = 0
+ alt_unit_names_are_symbols = NO
alt_unit_names = {"0":"WAI","3":"KWAI","6":"MWAI","9":"GWAI","12":"Szabo","15":"Finney","18":"Ether","21":"KEther","24":"MEther"}
@@ -156,18 +161,23 @@ Implementation considerations
iOS has a built-in currency formatter, which can be configured from a locale.
It knows how to deal with group-separators and where to apply them (e.g. India
-uses a mixture of thousands and hundreds instead of putting the separator after
-each 3 digits like western currencies).
-Set the formatter's parameter 'maximumFractionDigits' to 8, then it will not
-round the value and thus can be used for the whole amount.
-Set its parameter 'minimumFractionDigits' to 'z' (fractionalTrailingZeroDigits)
-to let it automatically add trailing zeroes.
-Then convert all fractional digits after 'n' (fractionalNormalDigits) to
-SuperScript digits.
-
-(please add information about Android and WebEx here)
-
-
+uses a mixture of thousands and hundreds instead of putting the separator
+after each 3 digits like western currencies). Set the formatter's parameter
+``maximumFractionDigits`` to 8, then it will not round the value and thus can
+be used for the whole amount. Set its parameter ``minimumFractionDigits`` to
+'z' (``fractionalTrailingZeroDigits``) to let it automatically add trailing
+zeroes. Then convert all fractional digits after 'n'
+(``fractionalNormalDigits``) to SuperScript digits.
+
+The field ``alt_unit_names_are_symbols`` was introduced in order to help UIs
+better decide how to render amounts with unit names (e.g. BTC, mBTC) instead
+of unit symbols (e.g. €, k€). Typically, currency symbols (in Android and iOS)
+are rendered, depending on the locale, before or after the amount without a
+space in between (e.g. €10), however, if the given currency has names instead
+of symbols for its units, rendering amounts without a space in between
+(e.g. BTC10) is not ideal and results in ugliness and user
+dissatisfaction. When this field is set to ``true``, it is expected that the
+wallet apps will render the amount with a space in between.
Definition of Done
==================