bobbingwide / oik

OIK Information Kit
https://www.oik-plugins.com/oik-plugins/oik
GNU General Public License v2.0
2 stars 0 forks source link

Test compatibility with WordPress 6.3 #217

Closed bobbingwide closed 1 year ago

bobbingwide commented 1 year ago

In WordPress 6.3 there have been some changes to ensure code conforms to coding standards. This has affected the internationalization and localization of strings in the shared libraries which are defined with a text domain of null.

There were also a couple of other minor changes to take into account.

Proposed method

Possible new solution

It depends on the number of translatable strings that are implemented in the shared libraries.

See also https://github.com/bobbingwide/bobbingwide/issues/101

bobbingwide commented 1 year ago

In WordPress 6.3 there's a change in get_translations_for_domain() to set the global $l10n array for every domain even if it nothing is loaded

    $l10n[ $domain ] = &$noop_translations;

This was affecting the logic in oik_l10n_gettext() The code should be changed to use is_textdoman_loaded() as this function now returns false when the domain has been loaded as an instance of NOOP_Translations.

bobbingwide commented 1 year ago

In order to debug the localization problem I needed to ensure the tests worked for WordPress 6.2.2 and then rerun them with WordPress 6.3. I wrote some simple logic to cater for different versions of jQuery and jQuery-migrate. The new method replace_jquery_versions() is only aware of WordPress 6.2 and 6.3. It doesn't bother to check the WordPress version. It just applies the string replacement set the versions to m.n.p Major - Minor - Patch.

The generated HTML file should now be WordPress version independent.

bobbingwide commented 1 year ago

I found a test case that failed when WooCommerce was activated.

bobbingwide commented 1 year ago

Delivered in v4.9.1. v4.9.2 has been tested with WordPress 6.3.1