Skip to content
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

Closed
wants to merge 6 commits into from
Closed

FluentBundle.compound #360

wants to merge 6 commits into from

Conversation

stasm
Copy link
Contributor

@stasm stasm commented Apr 26, 2019

This is a continuation of the work started by @unclenachoduh in #322.

@stasm stasm mentioned this pull request Apr 26, 2019
get messages() {
return this._messages[Symbol.iterator]();
}

Copy link
Member

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();
}

Copy link
Contributor Author

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.

@stasm stasm mentioned this pull request Apr 29, 2019
if (typeof message === "string") {
return this._transform(message);
format(path, args, errors) {
let parts = path.split(".");
Copy link
Collaborator

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.

@stasm stasm added this to To do in @fluent/bundle 0.14 Jul 11, 2019
@stasm stasm removed this from To do in @fluent/bundle 0.14 Jul 11, 2019
@stasm
Copy link
Contributor Author

stasm commented Jul 11, 2019

We're going to the go with the formatPattern proposal in #380.

@stasm stasm closed this Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants