Skip to content

StringLiterals and VariantKeys should not go though bundle._transform #387

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

Closed
stasm opened this issue Jul 11, 2019 · 3 comments
Closed

StringLiterals and VariantKeys should not go though bundle._transform #387

stasm opened this issue Jul 11, 2019 · 3 comments

Comments

@stasm
Copy link
Contributor

stasm commented Jul 11, 2019

I noticed this while working on #380. I'd like to discuss this in detail in the spec, but also fix this in a common-sense manner right now.

@Pike
Copy link
Contributor

Pike commented Jul 12, 2019

TBH, I would expect StringLiterals to go through pseudo localization.

I'm having formatToParts run around my head a lot, and I wonder if this would be the first thing to benefit from formatComplexPattern to be "to parts", and to move the transform into the bundle?

@stasm
Copy link
Contributor Author

stasm commented Jul 12, 2019

We'll need to discuss the details of how StringLiterals should be handled separately. I expect we'll want to exclude them from transform in cases like the following:

# "percent" should not be transformed.
string-literal-as-named-arg = {NUMBER(1, style: "percent")}

# "one" should not be transformed.
string-literal-as-selector = { "one" ->
    [one] One
   *[other] Other
}

# Not part of Fluent Syntax 1.0, but a possible addition in the future.
# "special key" should not be transformed.
string-litera-as-variant-key = { $var ->
    ["special key"] Special
   *[other] Other
}

Moreover, StringLiterals used as placeables already have the semantics of preserving the literal content from feratures like whitespace trimming.

trailing-whitespace = Foo{"         "}

It would make sense to me to extend this behavior to "protect" content from bundle._transform.

In the short term, I see disabling transforms for all StringLiterals as a good and safe starting position.

@stasm
Copy link
Contributor Author

stasm commented Jul 17, 2019

Fixed on the release branch in #394.

@stasm stasm closed this as completed Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants