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
FluentBundle.compound #360
Conversation
get messages() { | ||
return this._messages[Symbol.iterator](); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to retain some way of iterating over a bundle's messages. Atm. e.g. print()
in tools/format.js
ends up needing to access bundle._messages
.
How about something like this?
get messageKeys() {
return this._messages.keys();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to add this right now. I don't know of good runtime use-cases for iterating over all messages in a bundle. I usually prefer to keep the API surface as small as possible, and extend it only when needed.
The code in tools/format.js
should use the result of the full-AST parsing from fluent-syntax
to build an iterable of message keys for the purpose of printing all messages. I intend to fix it in a follow-up but I can also do it here.
if (typeof message === "string") { | ||
return this._transform(message); | ||
format(path, args, errors) { | ||
let parts = path.split("."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just use path.split(".", 1);
to separate one .
and not bother with anything past that. The rest is an attribute name.
We're going to the go with the |
This is a continuation of the work started by @unclenachoduh in #322.