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

i18n: Allow setting locale data by domain #5489

Merged
merged 2 commits into from
Mar 14, 2018
Merged

Conversation

aduth
Copy link
Member

@aduth aduth commented Mar 8, 2018

Closes #5168
Cherry-picks 685eaf0 from #5481

This pull request seeks to enable a plugin to inject their own domain locale data into the global wp.i18n module, refactoring gutenberg_get_jed_locale_data as a general-purpose Jed locale formatter (removing previous assumptions of being the default domain).

Example:

wp.i18n.setLocaleData( { '': {}, foo: [ 'bar' ] }, 'myplugin' )
console.log( wp.i18n.__( 'foo', 'myplugin' ) );
// "bar"

Testing instructions:

Verify that there are no regressions in the display of default localized strings for Gutenberg.

Try the example above in your browser console while on the Gutenberg screen, verifying that "bar" is logged to the console.

@aduth aduth added the Internationalization (i18n) Issues or PRs related to internationalization efforts label Mar 8, 2018
@bordoni
Copy link
Member

bordoni commented Mar 13, 2018

Would love to see that merged, we are trying to get that localization going for The Events Calendar compatibility. 🖤

@aduth aduth merged commit 955f7b7 into master Mar 14, 2018
@aduth aduth deleted the add/set-locale-data-domain branch March 14, 2018 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants