Replies: 2 comments 3 replies
-
How are these different from "regular" message references? |
Beta Was this translation helpful? Give feedback.
-
Would it? I'm not sure we have a namespacing concept at the moment--this is kind of what @mihnita was talking about in telecon wrt non-local variables. We have no definition of non-local values currently (and thus no namespacing). Note that I'm not saying we shouldn't have it or that we couldn't allow for it--just that we're currently mute about it AFAIK? How does a function get connected to its implementation? If it is always a I am concerned that this is a particularly sharp-edged feature. It is basically a mechanism for string concatenation. I would expect that developers will do a poor job of designing/setting these up and then it seems to require that individual translators need to provide modifications to the "protected" parts of the message pattern (such as to provide the case needed by Finnish)--they may not know if the function can provide e.g. an "inessive" case or what the fallback will be. If the goal is to mark up terms from the termbase so that the translator selects approved terminology, that's very different. But I've had better luck with whole-pattern selection, i.e. something more like:
(We had this as a feature 10 years ago in FireOS, where |
Beta Was this translation helpful? Give feedback.
-
This is a bit of an offshoot from a discussion with @stasm around issues such as that covered in #149. Mostly it's premised on adopting the EZ data model, but at least partly applies otherwise as well. I'm also using Fluent-ish syntax just because it's pretty close to being able to express what I want.
Background
To start with, there is an existing need to define commonly used terms such as product names that are used across multiple resources. For instance, Firefox always includes a
brand.ftl
resource in its bundle, with these (abbreviated) contents in English:In some languages (such as Finnish), these brand terms need to use a gender or case selector:
In Fluent,
-brand-short-name
is a term, i.e. a message that is only referrable from other messages. It's used like this:Proposed Syntax
I believe that a use case like this would be invaluable to have supported in MF2. However, I think that the ergonomics and discoverability of such message references could be improved from those of Fluent. To start with, Flunt considers each such resource to overlay on top of each other, so a Fluent bundle does not namespace the resources that it contains from each other, whereas MF2 would allow for such namespacing.
My proposal therefore would be to permit for syntax like this:
Where the
BRAND()
function would be implemented as a message resource, looking a bit like this:Here
func_name
ends up as a resource-level metadata entry that lets the processing system understand that its contents ought to be accessible asBRAND(msg_id, key: value, ...)
. In the data model, such a reference would end up being parsed as a MessageReference that includes the appropriateres_id
for the brand resource.Benefits
The main thing here is that this would allow for the definition of glossary-type functions that would have really well defined arguments and outputs using no implementation code. If something like this were included, then we probably would not want to support other forms of cross-resource message references in the syntax. It would also be pretty easy for tooling to make these functions and their arguments discoverable.
No changes would be needed for the EZ data model proposal to support this syntax.
Beta Was this translation helpful? Give feedback.
All reactions