Open caridy opened 2 years ago
You're looking for parametrized terms, https://projectfluent.org/fluent/guide/terms.html.
FWIW, terms are not to group information, but to encapsulate terms that might change on context. Branding is one example, and the purpose of Terms doesn't go far beyond that.
FWIW, terms are not to group information, but to encapsulate terms that might change on context.
That's the use case scenario Caridy has in his project but for a lot of terms like "Account", "Product", "User" etc. that they want to parametrize per product/consumer.
I smell #80?
I'm not sure how they want to define relations between terms - @caridy is Dynamic References proposal fitting here for you?
@zbraniecki I'm not sure yet, let me dig deeper.
@Pike I got very confused, the dynamic references proposal by @stasm (in the issue description) explicitly adds information to the term making them more message-like, at least at first glance that's what I'm getting. I understand that that part is not necessary the core of the dynamic reference proposal, but nevertheless it is there.
-brand-name = Aurora
.gender = feminine
.anadrome = Arorua
Term's attributes were meant to capture metadata. The grammatical gender is a good example. However, the anadrome is not. Arorua
is a facet of the brandname's value, a variant which depends on some grammatical or some other feature. It's translatable content, just like the main value, Aurora
.
I'd suggest something like the following:
-brand-name =
{ $spelling->
*[forwards] Aurora
[backwards] Arorua
}
.gender = feminine
You can the use both variants in placeables:
hello = Hello, {-brand-name(spelling: "backwards")}!
It seems that some symmetry between messages and terms are missing, intentionally or not, and I will like to understand better the "why". Let's see the example from the documentation:
In this example, the message
login-input
can have attributes that are placeables, while-brand-name
term can only have metadata (values for selection and such). The specific parsing error is:E0019: Attributes of terms cannot be used as placeables
.I might be missing some fundamental design principle that makes terms a lot more more restrictive than messages, but in principle, it looks to me that the ability to group information (of various kind) should be common for both. This issue is also in the same realm as https://github.com/projectfluent/fluent/issues/338.
cc @gonzalocordero