-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
i18n: Add create-i18n function #21182
Conversation
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.
Thanks 👍
Size Change: +82 B (0%) Total Size: 857 kB
ℹ️ View Unchanged
|
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.
data
not optional in setLocaleData
.
This bit of feedback slipped through the cracks. I can address it here.
|
On second thought, this is in a good place to merge and these changes can be made in follow-up PRs. |
I don't see where we're exporting the default instance? It would be good to avoid that if we are. |
It's here: Would you prefer we remove that here? |
I think the original issue was different, where previously with: ...combined with: ...it would result in |
I had understood that the methods on the shared i18n singleton would not be provided by the package at all, and instead WordPress would instantiate and provide a default here: That would be a breaking change in this package's API and would address partially #8981. I'll leave the default translation functions. |
export default instance updated the changelog instantiate locale in constructor refactor as per feedback rename I18N to I18n updated docs added isRTL
71fa5a8
to
87bb2f5
Compare
Closes #20318 which stagnated and was apparently abandoned. Part of #19210.
Quoting:
Description
As per the proposed solution in #19210 I've refactored the
@wordpress/i18n
module to expose an instantiable class. e.g.There are no changes to the existing external interface of the module other than the addition of the
I18N
class.How has this been tested?
Via the existing suite of unit tests and an additional unit test.
Screenshots
N/A
Types of changes
New feature.
Checklist: