gutenberg-examples icon indicating copy to clipboard operation
gutenberg-examples copied to clipboard

Include build tool configs for i18n

Open iandunn opened this issue 7 years ago • 3 comments

Currently the code examples use __(), but don't include any of the build tool configs necessary to make __() actually output localized strings.

Related: https://github.com/swissspidy/gutenberg-i18n-block

iandunn avatar Jul 13 '18 14:07 iandunn

@iandunn we have both es5 & esnext examples should we add the build tool config to both? cc: @swissspidy

ajitbohra avatar Aug 03 '18 00:08 ajitbohra

Why not? It makes sense. I haven't really followed development here but it seems that even #23 already uses __() and setLocaleData() without anything to actually make the localization work. A half baked implementation, regardless of ES5 or ESNext is far from ideal. IMHO every example should include fully working I18N examples.

Unfortunately the current tools/solutions are still very fragmented and implementations differ when hosting on WordPress.org or not.

For the ES5 examples https://github.com/swissspidy/gutenberg-i18n-block/tree/no-babel is probably the best bet as it uses WP-CLI to extract strings and doesn't rely on Babel or any other npm package. It's really straightforward.

For ESNext examples the master branch of that repo is a good start.

swissspidy avatar Aug 05 '18 11:08 swissspidy

Thanks for the info @swissspidy exactly what I was looking for, was not aware of no-babel branch.

Will update #23 to include this

ajitbohra avatar Aug 06 '18 07:08 ajitbohra

This issue seems to have been addressed prior to the major overhaul of this repo. Closing but we can re-examine if needed.

ryanwelcher avatar Mar 07 '23 18:03 ryanwelcher