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

Rename "context" to "bundle" #276

Merged
merged 3 commits into from
Aug 20, 2018
Merged

Conversation

stasm
Copy link
Contributor

@stasm stasm commented Aug 17, 2018

API changes:

  • Rename MessageContext to FluentBundle.
  • Rename MessageArgument to FluentType.
  • Rename MessageNumberArgument to FluentNumber.
  • Rename MessageDateTimeArgument to FluentDateTime.
  • Rename mapContextSync to mapBundleSync.
  • Rename mapContextSync to mapBundleSync.
  • Rename the messages prop of <LocalizationProvider> to bundles.

Other internal changes:

  • Rename all uses of ctx, cx, mcx, mc, ctxs and contexts to bundle or bundles.
  • Rename Localization's somethingFromContext methods to somethingFromBundle.
  • Rename Localization.ctxts to bundles.
  • Rename generateMessages to generateBundles in documentation and examples.

@@ -10,7 +10,7 @@ natural language.
The `fluent-gecko` build system produces `*.jsm` files which are ready to be
used as Gecko modules.

`Fluent.jsm` exports the `MessageContext` constructor which provides the
`Fluent.jsm` exports the `FluentBundle` constructor which provides the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zbraniecki Do we have a Fluent.jsm in fluent-gecko?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we have MessageContext.jsm

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, of course not. Why would we? :( Sorry, Yeah, we have MessageContext.jsm, and I'm happy to rename it to FluentBundle.jsm


MessageContext.jsm: $(SOURCES)
FluentBundle.jsm: $(SOURCES)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zbraniecki What's your preference wrt. renaming this JSM? Should we do it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference. Happy to follow your preference.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference. Open to renaming it. At least to Fluent.jsm :)

Copy link
Collaborator

@zbraniecki zbraniecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename generateMessages to generateBundles everywhere and rename the Gecko thing to Fluent.jsm - but both are just mild preferences.

*
* @returns {Localization}
*/
constructor(resourceIds = [], generateMessages) {
this.resourceIds = resourceIds;
this.generateMessages = generateMessages;
this.ctxs = CachedAsyncIterable.from(
this.bundles = CachedAsyncIterable.from(
this.generateMessages(this.resourceIds));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generateBundles? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, I forgot fluent-dom had those too.

@@ -10,7 +10,7 @@ natural language.
The `fluent-gecko` build system produces `*.jsm` files which are ready to be
used as Gecko modules.

`Fluent.jsm` exports the `MessageContext` constructor which provides the
`Fluent.jsm` exports the `FluentBundle` constructor which provides the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, of course not. Why would we? :( Sorry, Yeah, we have MessageContext.jsm, and I'm happy to rename it to FluentBundle.jsm


MessageContext.jsm: $(SOURCES)
FluentBundle.jsm: $(SOURCES)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference. Open to renaming it. At least to Fluent.jsm :)

bundle1 = new FluentBundle();
bundle1._setMessages(['bar']);
bundle2 = new FluentBundle();
bundle2._setMessages(['foo', 'bar']);

generateMessages = async function *generateMessages() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generateBundles?

@@ -48,8 +48,8 @@ class that provides just the API needed to format messages in the running code.
import { Localization } from 'fluent-dom'

function *generateMessages() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generateBundles?

@stasm stasm merged commit cc27987 into projectfluent:master Aug 20, 2018
@stasm stasm deleted the fluent-bundle branch August 20, 2018 14:06
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.

2 participants