Dear ICU team & users,
I would like to propose additions to the number skeleton syntax for ICU 67.
Ticket: https://unicode-org.atlassian.net/browse/ICU-20418
Please provide feedback by: next Tuesday, 2019-10-29
Designated API reviewer: Markus
tl;dr: where you would currently need to write,
.00 group-off notation/compact-short sign-display/except-zero
you will now be able to write,
+? 0.00 k
This proposal does not change support for existing skeletons. Existing (long-form) skeletons will always continue to work, and the toSkeleton API will continue to return the long-form skeletons. This proposal is only to add concise syntax that is intended to be more readable and easier to write.
Number skeletons are used to express locale-agnostic number formatting styles. They can be used via either the NumberFormatter API or via MessageFormat with the "::" prefix. They are documented here:
https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md
The concrete additions I propose:
Proposal: add a new blueprint stem with the following syntax:
Starts with either "0" (no grouping) or "0,0" (auto grouping)
If this is the end of the token, stop.
Expect the next character to be "."
Consume the remainder of the token as Fraction Precision.
Examples:
Proposal: add shortcut tokens for all sign display options, as shown in the following table.
Proposal: accept the UTS 35 core unit identifier syntax, which is the same as the unit identifier except without the type. CLDR guarantees that the core unit identifiers are unique. It also allows arbitrary combinations of simple units with "-per-".
Proposal: accept the following blueprint stem for scientific notation:
Start with "E" (capital E)
Allow "+", "+?", or "+!" interpreted as an abbreviated sign display option
Follow with one or more 0s for exponent min digits
Examples:
Proposal: allow the following abbreviations for popular options.
Additional suggestions are welcome.
Sincerely,
Shane
--
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CABxsp%3DkO4jNNWt_Q-evzNKmG6ei%2B%2BXBRN5bfb-FxEkr1jsVtEQ%40mail.gmail.com.
My mailer failed to pick up the WG address, which gave me the opportunity to correct the typos.
From: Phillips, Addison
Sent: Wednesday, October 30, 2019 3:10 PM
To: 'Alan Liu' <liu...@google.com>; Shane Carr <sf...@google.com>
Subject: RE: ICU proposal: Concise number skeleton syntax
Off the cuff a few thoughts.
An occasionally useful feature of the old SimpleNumberFormat syntax is the ability to zero-fill to the left of the decimal point. There is also the ability to limit the number of decimal places without zero filling, e.g. “000.00#” (for some locales) formats 1.2343 as “001.234” and 1.2 as “001.20”.
This suggests that the grouping flag can occur without a symbol to the left of it, e.g. “,” is equivalent to “0,0”.
(following is just thinking out loud and not a serious proposal) A different model for this would be printf style notation, adapted for our usage, e.g. things like
+04.3d (sign-always, zero filled to 4 digits, 3 digits precision)
0,4i [or ,04i] (zero filled 4-digit integer with grouping)
,i (grouping used integer)
,d (grouping used, unlimited precision decimal)
,.2d (grouping use, 2 decimal digits)
Addison
Addison Phillips
Sr. Principal SDE – I18N (Amazon)
Chair (W3C I18N WG)
Internationalization is not a feature.
It is an architecture.
1. Starts with either "0" (no grouping) or "0,0" (auto grouping)
2. If this is the end of the token, stop.
3. Expect the next character to be "."
4. Consume the remainder of the token as Fraction Precision.
1. Start with "E" (capital E)
2. Allow "+", "+?", or "+!" interpreted as an abbreviated sign display option
3. Follow with one or more 0s for exponent min digits
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CAC9cTncPVmPQhf%2BoRygtQLCMXd6iO3%2B07OuxFieOjYe8dO6iiQ%40mail.gmail.com.
1. Concise sign display
2. Concise grouping (starting with `,`)
3. Concise integer width (starting with `0`)
4. Fraction precision (starting with `.`)
5. Concise notation (starting with `K` or `E`)
6. Concise percent (starting with `%`)
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CABxsp%3DnjG1wJSvhFqaCHLEOH4DUD0E%3DZ8DgZu7Mq%2BoD9tw-WAg%40mail.gmail.com.
I tend to agree with your reasoning. So I’m closer to your original proposal than to Alt1 or Alt2 generally.
If the syntax ends up with all manner of arcane options (and I think it’s to some degree unavoidable), the recourse to documentation will happen anyway, but if at least the commonly used options were more like picture strings (without, you know, *being* picture strings—because that’s the problem we’re trying to solve), that might be ideal.
I tend to prefer default options being on unless you turn them off, hence I prefer not having to say anything about the sign to get “auto”.
We might make the syntax more compact by using integers for the number of zero-fill digits, e.g. “+,5.2” is “+,00000.00” in the proposal.
FWIW, I favor no-space tokens to make the parsing and handling more reliable when working with message format patterns and such.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/2efa956f7778404899ee8a39998693a5%40EX13D08UWB002.ant.amazon.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CADdLYsozQO8%2Bax03F4rS61Duozgq8Z5R%3D6et9F_32qzHXOKh%2Bw%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format-wg+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CABxsp%3D%3DbfZ2UvUR6EMsyWWURoNLE-rTTV0UM_RTBgJYwhMP%3DnA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format-wg+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CABxsp%3DnjG1wJSvhFqaCHLEOH4DUD0E%3DZ8DgZu7Mq%2BoD9tw-WAg%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format-wg+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/2efa956f7778404899ee8a39998693a5%40EX13D08UWB002.ant.amazon.com.
----+55 (16) 98138-1583, skype: rxaviers
http://rafael.xavier.blog.br
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format-wg+unsubscribe@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CABxsp%3D%3DbfZ2UvUR6EMsyWWURoNLE-rTTV0UM_RTBgJYwhMP%3DnA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CABxsp%3DnjG1wJSvhFqaCHLEOH4DUD0E%3DZ8DgZu7Mq%2BoD9tw-WAg%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/2efa956f7778404899ee8a39998693a5%40EX13D08UWB002.ant.amazon.com.
----+55 (16) 98138-1583, skype: rxaviers
http://rafael.xavier.blog.br
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CADdLYsozQO8%2Bax03F4rS61Duozgq8Z5R%3D6et9F_32qzHXOKh%2Bw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Message Format Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to message-format...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/84e8fa5b-3bc7-4f4c-adf7-7d835077a211%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CAC9cTnfrsAB-9apFW_3ey%2B5g6Gp21LqVojQyY4nYwEssaK2vLA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/message-format-wg/CAFuwTa54hG9_B07rYmt5C-ytB%3DxA2joii2qypiQJBpa86bPypw%40mail.gmail.com.