WordPress / gutenberg-examples

Examples for extending WordPress/Gutenberg with blocks.
1.2k stars 316 forks source link

Include build tool configs for i18n #27

Closed iandunn closed 1 year ago

iandunn commented 6 years ago

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

ajitbohra commented 6 years ago

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

swissspidy commented 6 years ago

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.

ajitbohra commented 6 years ago

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

Will update #23 to include this

ryanwelcher commented 1 year ago

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