-
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
Allow all inline expressions as named arguments #230
Comments
Hello! Just asking about if there's any progress of deciding this feature. When I started using Fluent lately this is a feature I dearly started to miss. |
I've also run into this same issue; IMO it's definitely necessary. Without the ability to 'pass through' variables into terms, it's not possible to abstract out a chunk of text logic like the way you might abstract some code out into a function, which severely limits the usefulness of terms. I was really surprised to find that this isn't supported... |
Very much in favor. Related: #325. |
Some of the use cases above sound like exactly the kind of thing we should be avoiding if messages are to be properly translatable:
If those in favour of the feature could provide fuller examples I think it would help - all the examples I can think of I would consider to be counter-arguments. We also need to consider that "all inline expressions" is a large broadening. If only certain types of expressions are needed, we should not broaden to all expression types. As an implementer of multiple implementations, I want to note that the current restrictions on named arguments have some big upsides in terms of simplicity, particularly for implementations like mine that function as a compiler, since all arguments to the term are fully known at compile time. |
Is there any news? |
@spookylukey my use-case is actually exactly the opposite of this. Ability to build complex phrases based on flags which are passed from application would let us have a "black box" and let localization professionals to handle all of this in fluent's domain |
This was originally filed as #188 concerning
VariantExpressions
which was since removed from the Fluent Syntax. However, the same problem remains in named arguments to call expressions.Given a term defined as follows:
-thing = { $count -> *[one] thing [other] things }
Should we allow this?
you-own = You have { $count -> *[one] a {-thing(count: $count)} [other] {-thing(count: $count)} }.
Right now, only
NumberLiterals
andStringLiterals
can be passed as named arguments, so the work around is to pass the names of requested variants explicitly:Or:
The text was updated successfully, but these errors were encountered: