Skip to content
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

Term's attributes can't be used as placeable #339

Open
caridy opened this issue Nov 5, 2021 · 6 comments
Open

Term's attributes can't be used as placeable #339

caridy opened this issue Nov 5, 2021 · 6 comments

Comments

@caridy
Copy link

caridy commented Nov 5, 2021

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:

login-input = Predefined value
    .placeholder = email@example.com
    .aria-label = Login input value
    .title = Type your login email

-brand-name = Aurora
    .gender = feminine
    .anadrome = Arorua
    
x = { login-input.title }
y = { -brand-name.anadrome }

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 #338.

cc @gonzalocordero

@Pike
Copy link
Contributor

Pike commented Nov 5, 2021

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.

@zbraniecki
Copy link
Collaborator

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.

@Pike
Copy link
Contributor

Pike commented Nov 5, 2021

I smell #80?

@zbraniecki
Copy link
Collaborator

I'm not sure how they want to define relations between terms - @caridy is Dynamic References proposal fitting here for you?

@caridy
Copy link
Author

caridy commented Nov 6, 2021

@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.

@stasm
Copy link
Contributor

stasm commented Nov 10, 2021

-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")}!

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

4 participants