-
-
Notifications
You must be signed in to change notification settings - Fork 36
Automatic selection of formatter by argument type #42
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
Comments
ICU is (I think) more consistent:
I think we should support all 3 variants. |
I agree, and one aspect that I don't think we have a thread on is the simplicity of the syntax. While I love how powerful Fluent I think it might be one level too complex to hand off directly to linguists as raw syntax. If we go that route, then we know we will have a hard dependency on TMSes and other tools which will make adoption much harder. Also, I think we should be careful about I think it would be good to define which types we want to support, their predefined formats and which "options" they can support as extra dynamic metadata. These predefined values should always be defined for each type, and give enough flexibility to meet all needs around a given type. The goal of supporting types should be to have a "one-stop-shop" syntax. I don't feel today we can say this for |
I would like to take note of some of the benefits of the explicit notation. They have been mentioned at various times as we were working on Fluent. While we ultimately decided to allow implicit formatting, I still think there are merits to the explicit approach. key1 = {PLURAL($emailCount) ->
[one] You have one email
*[other] You have {NUMBER($emailCount)} emails
}
key2 = Today is {DATETIME($now)}
|
I retitled this to be a little more clear (I hope). The phrase "certain positions" seemed to have something to do with e.g. argument order. @zbraniecki please fix the title if you don't agree with my recharacterization. |
I mistakenly marked this as resolve candidate thinking this was addressed by requiring annotation for selectors, but of course that leaves placeholder defaulting... This is actually an important issue and we need to resolve how annotation-less placeholders decide what formatter to employ (even if it is to say that it is implementation dependent) |
Fixes #42 Also addresses some problems with normative terms in the same text.
#456) * Allow expressions without annotations to dynamically choose a function Fixes #42 Also addresses some problems with normative terms in the same text. * Address comment about the bad normative text * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> * Attempt to implement WG consensus from 2023-08-28 call - Made one fix to inappropriate normative language - Removed the formatting allowance previously inserted - Reversed the order of the expression resolution "sieve", so that the complicated optional goo goes at the end. - Allow (but not require) an implementation to use the value of a _variable_ to assign the annotation - Allow (but not require) an implementation to use the value of a _literal_ to assign the annotation if-and-only-if the literal does not appear in an declaration This is complicated and probably begging for examples. * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> * Better reflect current consensus * Address comments * Formatting cleanup * Move all of the example inside the example Must drink more coffee ☕ * style: Apply Prettier * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/formatting.md Co-authored-by: Eemeli Aro <[email protected]> --------- Co-authored-by: Eemeli Aro <[email protected]> Co-authored-by: Eemeli Aro <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fluent implicitly formats arguments in three situations:
NumberFormatter
DateFormatter
PluralRules
The result is that the following are roughly equivalent:
and
The localizer can still decide to use the explicit formatter if they want to pass parameters:
but in most cases, the implicit formatting does the job.
The text was updated successfully, but these errors were encountered: