Closed HTGAzureX1212 closed 7 months ago
This is intentional. The hypothesis was that term is a private construct and should be changable without obsoleting. If you want to use a term, construct a message that references it.
@stasm to verify my words.
That's correct. Quoting https://projectfluent.org/fluent/guide/terms.html:
Terms are similar to regular messages but they can only be used as references in other messages. (...) The runtime cannot retrieve terms directly.
As noted, terms are primarily useful specifically because they cannot be accessed by the runtime and thus are by definition up to the localizer. I appreciate this flexibility of having access to a way to compose messages out of smaller parts if desired without worrying about the code end of things and what usages I might be breaking. The list of messages is controlled by the code/consumer. As a localizer those are fixed and out of your control. Terms on the other hand are at the discretion of the localizer and can/likely will be different between localizations of the same strings depending on the needs of a language. Adding this interface would compromise that and goes against the spirit of why they are in the spec in the first place.
This PR adds a
get_term
method such that terms can also be localized via a similar API to that of messages.