-
Notifications
You must be signed in to change notification settings - Fork 77
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
Conversation
@@ -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 |
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.
@zbraniecki Do we have a Fluent.jsm
in fluent-gecko
?
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.
No, we have MessageContext.jsm
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.
No, of course not. Why would we? :( Sorry, Yeah, we have MessageContext.jsm, and I'm happy to rename it to FluentBundle.jsm
fluent-gecko/makefile
Outdated
|
||
MessageContext.jsm: $(SOURCES) | ||
FluentBundle.jsm: $(SOURCES) |
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.
@zbraniecki What's your preference wrt. renaming this JSM? Should we do it?
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.
No preference. Happy to follow your preference.
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.
No preference. Open to renaming it. At least to Fluent.jsm :)
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'd rename generateMessages
to generateBundles
everywhere and rename the Gecko thing to Fluent.jsm
- but both are just mild preferences.
fluent-dom/src/localization.js
Outdated
* | ||
* @returns {Localization} | ||
*/ | ||
constructor(resourceIds = [], generateMessages) { | ||
this.resourceIds = resourceIds; | ||
this.generateMessages = generateMessages; | ||
this.ctxs = CachedAsyncIterable.from( | ||
this.bundles = CachedAsyncIterable.from( | ||
this.generateMessages(this.resourceIds)); |
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.
generateBundles? :)
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.
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 |
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.
No, of course not. Why would we? :( Sorry, Yeah, we have MessageContext.jsm, and I'm happy to rename it to FluentBundle.jsm
fluent-gecko/makefile
Outdated
|
||
MessageContext.jsm: $(SOURCES) | ||
FluentBundle.jsm: $(SOURCES) |
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.
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() { |
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.
generateBundles
?
fluent-dom/README.md
Outdated
@@ -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() { |
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.
generateBundles
?
API changes:
MessageContext
toFluentBundle
.MessageArgument
toFluentType
.MessageNumberArgument
toFluentNumber
.MessageDateTimeArgument
toFluentDateTime
.mapContextSync
tomapBundleSync
.mapContextSync
tomapBundleSync
.messages
prop of<LocalizationProvider>
tobundles
.Other internal changes:
ctx
,cx
,mcx
,mc
,ctxs
andcontexts
tobundle
orbundles
.Localization
'ssomethingFromContext
methods tosomethingFromBundle
.Localization.ctxts
tobundles
.generateMessages
togenerateBundles
in documentation and examples.