-
Notifications
You must be signed in to change notification settings - Fork 45
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
Relax variant-name grammar #90
Comments
My concern here is that it opens up room for a lot of edge cases that may be confusing and potentially hard to handle. In particular:
I'm not completely against pursuing this direction (I know stas was in favor of it from the very beginning), but I'd like to see use cases and/or examples of users wanting to use this feature. I'm concerned about limiting our future options by relaxing the syntax with noone asking for it. |
I think there's value in Side question, is |
|
Use-casesThere are two use-cases which would be well-served by relaxing the grammar of
Native term attribute valuesTerm attributes are private to the current language. They may represent grammatical concepts which are foreign to the English grammar. Consequently, they may be hard to give English names to. To fully embrace the asymmetric design of terms and their attributes, I'd like to make it possible for attribute values to be written in the target language of the localization. -brand-name = Firefox
.Genus = männlich (Ideally, the attribute's name could also contain non-ASCII characters. I'll get back to this in a second.) Variable valuesThere might be cases where the localizer might want to provide a specialized translation for one of the possible variable values. # The ʻ character is U+02BB, outside of the Basic Latin block.
welcome = { $state ->
[Hawaiʻi] Aloha!
*[other] Welcome!
} In most cases, dynamic references (#80) will be the preferred way of implementing such UIs, but they do have the drawback of requiring the developer's intervention. For lightweight one-off customizations simple Proposed designI suggest that make the For names containing any other characters, including whitespace, This design has the advantage of being explicit about digits:
|
If I'm not mistaken this is something that we did not encounter anyone requesting yet. Can it wait for post-1.0 and any user request? |
The sooner we relax, the less trouble we'll encounter due to cross-channel. We haven't seen much use of custom term attributes yet, which is why I think we're not seeing these requests. I'd like to default to Unicode wherever possible. It's 2018. |
As I stated before, the risk of Unicode here is that it opens edge cases to be legitimate unless you blacklist them. Things like |
I'm trying to make a point that this is about matching strings, not identifiers. However, in context of identifiers, UAX31 could help us, yes. In my proposal, |
Would that make such code a valid FTL? |
No, because |
Oh! Thanks for explaining it to me! No objections. |
I filed #117 to keep this out of scope of this issue. |
I'd like to nominate this for Syntax 0.6 rather than 0.7. Or, perhaps we could separate this into two changes:
@Pike -- what do you think? #118 implements both in one go, but I'll be happy to split it in two. |
TBH, I don't like the proposal. I didn't get to actually read it before just now, sorry. What I don't like in particular is introducing identifier and it's constraints in an unrelated context. I think what we should do is more in the line of just supporting StringExpressions as VariantNames, and un-special-case the " for that context. That also implies dropping NumberExpression from the grammar.mjs, and to make the number detection in abstract.mjs, I think. Then In particular splitting this between 0.6 and 0.7 leaves us without the ability to express |
You're right about 0.6, let's keep this in 0.7 for now, thanks. Do you mean introducing a new production, say, What I think this boils down to is how we look at padded-variant-keys =
{ $num ->
[one ] One
[many ] Many
*[other] Other
} In the example above, what are the variants' keys?
If it's the former, than If it's the latter, than
I'm also not sold on moving the parsing of numbers to |
variant-name
is currently defined as one or morewords
.We don't use
words
anywhere else and I find it weird that they forbid so many arbitrary characters. Should we relax it to only forbid]
and maybe[
? Should we allow escaping with\]
? As in:[variant name with a closing bracket \] looks like this]
.Additionally, I don't see why we have to force
variant-name
to be non-blank.[]
should parse as a variant name of""
(a zero-width string). It's nor terribly useful, but consistent.The text was updated successfully, but these errors were encountered: