Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sffc
Copy link
Member

@sffc sffc commented Sep 25, 2024

CLDR-13651

  • This PR completes the ticket.

ALLOW_MANY_COMMITS=true

@sffc
Copy link
Member Author

sffc commented Sep 25, 2024

@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”.
Copy link
Member Author

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"

Copy link
Member

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.
  • 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€"

Copy link
Member Author

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 :)

@sffc sffc assigned macchiati and unassigned sffc Sep 25, 2024
Copy link
Member

@macchiati macchiati left a 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”.
Copy link
Member

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.
  • 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€"

@macchiati
Copy link
Member

macchiati commented Sep 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants