projectfluent / fluent

Fluent — planning, spec and documentation
https://projectfluent.org
Apache License 2.0
1.4k stars 45 forks source link

only use selected attributes #317

Open 117649 opened 3 years ago

117649 commented 3 years ago

Lets say that there is 2 attributes under 1 id : .label and .acceskey and for the obvious reason I only want .label on the html element. How could this be done?

macabeus commented 3 years ago

Well... But why would you have an .accesskey attribute? It looks like isn't a translatable phrase, so it should not be a Fluent message.

zbraniecki commented 3 years ago

The way Fluent thinks about it is that you have two "shapes" of localization messages:

Shape 1 has label+attribute and is used to localize UI Element 1 Shape 2 has only label and is used to localize UI Element 2

Those are two different shape and hence two different messages. You can abstract out a message and use it in multiple places via references:

my-key1 = 
    .label = Foo
    .accesskey F

my-key1-title =
    .label = { my-key1.label }
117649 commented 3 years ago

The way Fluent thinks about it is that you have two "shapes" of localization messages:

Shape 1 has label+attribute and is used to localize UI Element 1 Shape 2 has only label and is used to localize UI Element 2

Those are two different shape and hence two different messages. You can abstract out a message and use it in multiple places via references:

my-key1 = 
    .label = Foo
    .accesskey F

my-key1-title =
    .label = { my-key1.label }

I actually want to filter out unwanted attributes at the receive end without touch .ftl is this possible?