-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLDR-13651 Add spec text involving compact long currency format #4077
base: main
Are you sure you want to change the base?
Conversation
@macchiati The proposed algorithm doesn't seem to work correctly for the example data in the spec. |
@@ -407,6 +407,8 @@ Formatting 1200 in USD would result in “1.2 K $”, while 990 implicitly maps | |||
|
|||
The short format is designed for UI environments where space is at a premium, and should ideally result in a formatted string no more than about 6 em wide (with no fractional digits). | |||
|
|||
When `currencyFormatLength` is not included for a desired format length (short or long), the currency should be formatted without compact notation and then substituted as the numeric value into the corresponding `decimalFormatLength`, adjusting for the number of 0s. For example, using the above data, 12000 USD in compact long format would result in “12 $ mille”. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that the correct localized string should be "12 mille $" not "12 $ mille"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you that "12 $ mille" feels very odd, with the $ between parts of a number.
I have trouble understanding the sentence as written. Do you mean something like the following?
When there is no data available for <currencyFormatLength type=X>
, use the following process (with the example currency value <20034.56, EUR>:
- Look at the corresponding
<decimalFormatLength type=X>
pattern- if that pattern is "0" (which means use normal formatting), use
<currencyFormat type="standard">
to format, and exit.
- if that pattern is "0" (which means use normal formatting), use
- otherwise:
- format the numeric value of the currency value with
<decimalFormatLength type=X>
, such as 20034.56 → "20 M" - get the localized symbol for the pattern, eg EUR → "€"
- pick the pattern (plain or alt="alphaNextToNumber") based on the localized symbol and the formatted numeric value.
- replace the numeric part of the pattern by the formatted numeric value and the currency symbol character (¤) by the localized symbol, such as "#,##0.00¤" → "20 M€"
- format the numeric value of the currency value with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's not the algorithm I understood from the ticket and our CLDR-WG discussion. The algorithm I understood was:
- otherwise:
- Adjust the numeric value according to compact currency rules. For example, 20034.56 EUR becomes 20.03456c3, and after rounding becomes 20c3
- Format the mantissa using
<currencyFormat type="standard">
, as in "20€" - Substitute that value into the correct compact currency form (the one corresponding to "c3"), as in "20€ mille"
However, maybe your algorithm is better; at least it works in French, and my algorithm doesn't :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to take this back to Design
@@ -407,6 +407,8 @@ Formatting 1200 in USD would result in “1.2 K $”, while 990 implicitly maps | |||
|
|||
The short format is designed for UI environments where space is at a premium, and should ideally result in a formatted string no more than about 6 em wide (with no fractional digits). | |||
|
|||
When `currencyFormatLength` is not included for a desired format length (short or long), the currency should be formatted without compact notation and then substituted as the numeric value into the corresponding `decimalFormatLength`, adjusting for the number of 0s. For example, using the above data, 12000 USD in compact long format would result in “12 $ mille”. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you that "12 $ mille" feels very odd, with the $ between parts of a number.
I have trouble understanding the sentence as written. Do you mean something like the following?
When there is no data available for <currencyFormatLength type=X>
, use the following process (with the example currency value <20034.56, EUR>:
- Look at the corresponding
<decimalFormatLength type=X>
pattern- if that pattern is "0" (which means use normal formatting), use
<currencyFormat type="standard">
to format, and exit.
- if that pattern is "0" (which means use normal formatting), use
- otherwise:
- format the numeric value of the currency value with
<decimalFormatLength type=X>
, such as 20034.56 → "20 M" - get the localized symbol for the pattern, eg EUR → "€"
- pick the pattern (plain or alt="alphaNextToNumber") based on the localized symbol and the formatted numeric value.
- replace the numeric part of the pattern by the formatted numeric value and the currency symbol character (¤) by the localized symbol, such as "#,##0.00¤" → "20 M€"
- format the numeric value of the currency value with
Let's hold off on this for now; we need to work in the decimals and the
spacing. We can also test against the data for the locales we have.
…On Wed, Sep 25, 2024, 22:49 Shane F. Carr ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In docs/ldml/tr35-numbers.md
<#4077 (comment)>:
> @@ -407,6 +407,8 @@ Formatting 1200 in USD would result in “1.2 K $”, while 990 implicitly maps
The short format is designed for UI environments where space is at a premium, and should ideally result in a formatted string no more than about 6 em wide (with no fractional digits).
+When `currencyFormatLength` is not included for a desired format length (short or long), the currency should be formatted without compact notation and then substituted as the numeric value into the corresponding `decimalFormatLength`, adjusting for the number of 0s. For example, using the above data, 12000 USD in compact long format would result in “12 $ mille”.
No, that's not the algorithm I understood from the ticket and our CLDR-WG
discussion. The algorithm I understood was:
- otherwise:
- Adjust the numeric value according to compact currency rules. For
example, 20034.56 EUR becomes 20.03456c3, and after rounding becomes 20c3
- Format the mantissa using <currencyFormat type="standard">, as in
"20€"
- Substitute that value into the correct compact currency form (the
one corresponding to "c3"), as in "20€ mille"
However, maybe your algorithm is better; at least it works in French, and
my algorithm doesn't :)
—
Reply to this email directly, view it on GitHub
<#4077 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMEUTGGT3VUBBDK2TILZYON7ZAVCNFSM6AAAAABO3C2ECGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMZQGE3TQMBVGU>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
CLDR-13651
ALLOW_MANY_COMMITS=true