-
Couldn't load subscription status.
- Fork 106
Custom functions with scope access #364
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
base: main
Are you sure you want to change the base?
Conversation
|
Ping. |
|
@zbraniecki or @waywardmonkeys (or any other maintainers) has anybody had a spare minute to give this a quick gander? |
|
Ehh, some of that is by design (@stasm may remember more on why we didn't want to allow for expr inside named arguments). Message References are desirable feature, but are non-trivial to implement and I'd prefer to implement them in line with how @eemeli is planning to support them in MF2.0. @eemeli - can you look at the tests in this PR and comment on the alignment? As for the code - I only skimmed through and I do hope that we can improve the impl before we land this. My recommendation would be to take more time on this and not try to rush it. |
|
This seems pretty well aligned with MF2's custom functions, which is how it allows for something like messages references. I do have some concern about a general-purpose Also, splitting up a message like the example |
Sounds good not to rush with final implementation :) |
Tries to temporary solve complex translation cases mentioned in:
#268
projectfluent/fluent#80
Support user implemented custom functions that can access current scope, can work as Message references.
In future we could allow access in custom functions to additional information about current scope (developer arguments, local arguments, current errors)
Message references are highly needed for more complex translation cases with a lot of possible message combinations.
Additionally allow using expressions inside named arguments.
(It looks like by default fluent doesn't allow it Playground )
This functionality can be placed under boolean flag if we do not want to enable it by default.
See examples included in added tests.
Would like to get feedback if these changes can be upstreamed to fluent-rs.