infinum / eightshift-libs

Library that is meant to be used inside Eightshift Boilerplate and Eightshift Boilerplate Plugin libs via composer in order to be able to easily set up a modern development process.
https://eightshift.com
MIT License
62 stars 11 forks source link

[BUG] - i18n not set up correctly for plugin usage #442

Open dingo-d opened 1 week ago

dingo-d commented 1 week ago

WP 6.7 caused some weird translation issues, which got me looking into how the translations are handled in the libs.

Long story short, the translation class (I18nExample) is only valid for the themes, not plugins.

  1. In the case of the plugin, the call to translation callback (loadThemeTextdomain) should be hooked to init, not after_setup_theme
  2. In the case of the plugin, the callback should use load_plugin_textdomain function, not load_theme_textdomain (there's a difference)

I think you could create two examples, one for a theme and another for a plugin, and then in the CLI use one or the other.