fluent.js icon indicating copy to clipboard operation
fluent.js copied to clipboard

`withLocalization`'s `getString` API is missing the `elems` parameter

Open canova opened this issue 4 years ago • 1 comments

We are usually using the Localized component, but recently I was trying the withLocalization's getString API, and it looks like it is the missing the elems parameter, which is pretty commonly used in Firefox Profiler.

Also wiki seems to be missing more advanced usage information. It's not possible to see other parameters here: https://github.com/projectfluent/fluent.js/wiki/withLocalization

So, I tried to check the implementation of getString and realized that it doesn't have a elems parameter, like Localized: https://github.com/projectfluent/fluent.js/blob/a1ac29df2eba6b2e2652fddad96bc454c612acdf/fluent-react/src/localization.ts#L33-L52

Maybe there can be another way to pass these elements after getting the string, but I don't know how. I think it would be great to have an optional elems parameter inside the getString directly, so we can add elements directly with that API call.

To be clear, we are not blocked on this since Localized is fixed now and we can continue using that. But it would be good to have this as well. What do you think?

canova avatar Apr 08 '21 13:04 canova

I've often wanted similar functionality, so I just submitted a PR: https://github.com/projectfluent/fluent.js/pull/595

No idea if it fits with the project goals, but might at least be worth subscribing to for people interested in this issue :)

Vinnl avatar Jul 09 '22 11:07 Vinnl