-
-
Notifications
You must be signed in to change notification settings - Fork 36
Placeholders: What sigil(s) indicate them? #269
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
I wonder if these same arguments would be good reasons to avoid picking |
Almost every combinations is used somewhere :-) But one might make the argument that we should do something that is slightly different than others. |
I don't think either of those reasons hold up. The friction/conflict justification applies equally to any kind of string interpolation, but that has not prevented modern templating systems from settling in large part on two common patterns (and even there, with one appearing to be approaching dominance). As for the detection justification, the signal seems too weak to be useful—unless it is absolutely explicit (e.g., a "MessageFormat2:" prefix), there will be a large number of false positives (e.g., My opinion is that being different from the broader ecosystem for the sake of being different is harmful rather than helpful. However, that does not preclude being different for a supportable reason such as "conforming with a clear pre-existing convention in the narrower scope of internationalization". |
One option here might be to do something close to what Jinja does:
Specifically, we could consider the start of a placeholder to always be two characters, for example:
With that change, a |
I am skeptical about allowing
This I like. I generally favor not allowing white space in more places than necessary. It means that attempting to use unescaped curly braces as literal text yields a fail-fast syntax error. I don't think we need to complicate the syntax beyond that. |
+1
…On Tue, Jun 7, 2022, 16:56 Markus Scherer ***@***.***> wrote:
With that change, a { followed by a word character would not need to be
considered as syntax. In addition to any sigils that are chosen for initial
use, others would need to be reserved for later expansion.
I am skeptical about allowing { followed by a non-syntax character just
being a literal character. I did that in ICU MessageFormat with the ASCII
apostrophe, because it's the best I could do to make normal text mostly
work (previously a pair of apostrophes always enclosed literal text, as a
terrible kind of escaping syntax), but it still confuses developers.
Disallow whitespace between the initial { and any subsequent sigil.
This I like. I generally favor not allowing white space in more places
than necessary.
It means that attempting to use unescaped curly braces as literal text
yields a fail-fast syntax error. I don't think we need to complicate the
syntax beyond that.
—
Reply to this email directly, view it on GitHub
<#269 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJLEMBZSJFQ7HY7EFDP3P3VN7OTHANCNFSM5WBV5L7Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I like @eemeli's suggestion of Jinja-like syntax. I think it's easier to have a consistent outer marker ( |
I think I am OK with this, but should make sure we describe it properly (to be sure we are talking about the same thing) For me So yes, they don't allow spaces. |
And I am with Marcus on allowing Same as the |
develop
syntax uses{…}
, but the broader software ecosystem seems to have settled on a paradigm in which interpolated parts of text are indicated by either${…}
(JavaScript template literals and Mako templates) or{{…}}
(Mustache, Jinja(2) and Angular).Unless there is a clear pre-existing convention for single braces within the context of internationalization, I think it would be wise to conform with that external paradigm rather than diverging from it.
The text was updated successfully, but these errors were encountered: