Skip to content

fluent-syntax: Add syntax for plain text interpolation #74

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
mortyccp opened this issue Sep 15, 2017 · 6 comments
Closed

fluent-syntax: Add syntax for plain text interpolation #74

mortyccp opened this issue Sep 15, 2017 · 6 comments

Comments

@mortyccp
Copy link

Currently we have Message References.

brandName = Loki
installing = Installing { brandName }.

menu-save = Save
help-menu-save = Click "{ menu-save }" to save the file.

This indicate the translator to not translate the what inside the { }.

I suggest we can add another syntax to make the contents to be translated too.
For example

alert_message = Click #{ here } for more detail.

This is useful because we can keep the sentence to be translated all together. And if we provide AST form of the translated result, we provide the renderer ability to further enhance the appearance or behaviour of the word here.

@zbraniecki
Copy link
Collaborator

How is that different from:

alert_message = Click \{ here } for more detail.

?

@stasm
Copy link
Contributor

stasm commented Sep 15, 2017

It sounds like @mortyccp would like the AST to still reflect the fact that here is in a Placeable. If so, then escaping won't cut it. I might suggest the following solution:

alert_message = Click { "here" } for more detail.

@mortyccp
Copy link
Author

@stasm Ya it is exactly what I want.

@mortyccp
Copy link
Author

One more thing I would like to ask is how this Placeable will be represented in the AST? Does it have identifier for which Placeable it is?

@stasm
Copy link
Contributor

stasm commented Sep 16, 2017

No, there won't be an identifier, just a Placeable with a StringExpression in it. Also note that there has been a recent change to the AST of Placables: in fluent-syntax 0.5.0 the StringExpression will be a sibling of other elements of the Pattern. In #64 we changed this: there's now an intermediate Placeable node. I haven't yet released a new version of fluent-syntax with this change.

@stasm
Copy link
Contributor

stasm commented Jan 31, 2018

fluent-syntax 0.6 has been published and it includes the addition of AST.Placeable. I'm going to close this issue as it looks like #74 (comment) has a viable solution to the original problem.

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

No branches or pull requests

3 participants