runtime: add attribute formatting functionality in FluentLocalization#212
runtime: add attribute formatting functionality in FluentLocalization#212eemeli merged 6 commits intoprojectfluent:mainfrom
Conversation
eemeli
left a comment
There was a problem hiding this comment.
Extending format_value() like this would be rather misleading, as the added functionality is specifically about formatting a message attribute, not its value.
Instead, I think we should add a new method format_message(), which takes the same arguments as format_value(), but returns a tuple of the formatted value (or None, if there is no value), together with a dict of all of the formatted attributes, keyed by their names.
This connects with another Fluent design choice: attributes should not be used separately, but only as a part of the whole message.
Also, we do need to include tests and a documentation update when making an API change like this.
|
Sounds fair enough, I'll try to implement that soon. Anyway, I think that added functionality could be added too (with tests and docs, of course). According to the function name it should format any kind of values, even it is an attribute of a message, because attributes also have their own values. |
Never mind. Pattern resolving works not as I thought, so I refuse the idea. Just will implement what you've mentioned above |
eemeli
left a comment
There was a problem hiding this comment.
Looks promising! See inline for detail-y comments.
eemeli
left a comment
There was a problem hiding this comment.
Looks like there are some CI failures? Otherwise looks good.
Resolving issue with accessing message attributes via FluentLocalization.format_value("message.attribute")
Connected issues:
#209