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

Fix Afterburner translations with WordPress 6.5.0 #873

Merged
merged 2 commits into from
Apr 20, 2024

Conversation

kovshenin
Copy link
Contributor

Core 6.5.0+ introduced new translation classes and routines, removing the need for (and use of) the MO object, which Afterburner pomo relies on. This change brings back the old behavior when loading text domains.

See: https://github.com/humanmade/product-dev/issues/1546

Core 6.5.0+ introduced new translation classes and routines,
removing the need for (and use of) the MO object, which
Afterburner pomo relies on. This change brings back the old
behavior when loading text domains.
@rmccue
Copy link
Member

rmccue commented Apr 15, 2024

lgtm!

We did a bunch of testing here, with the final result being:

Screenshot 2024-04-15 at 15 51 11@2x

(core-php is core with .l10n.php file, core-mo is core with .mo file, afterburner-mo is Afterburner with .mo file, core-php-noopcache is core with .l10n.php file and opcache disabled via ini_set( 'opcache.enable', 0 );)

tldr: Core has made some massive improvements! Afterburner is still faster except for load_textdomain() (just like before).

Core also has a new trick where load_textdomain() doesn't do anything, and only lazy-loads the .mo on the first usage. By also introducing a proxy object between the translation calls and the actual files, it's able to avoid actually parsing a lot of files. We should implement both of these tricks in a future version of Afterburner.

@mikelittle mikelittle added this to the Altis v19 milestone Apr 17, 2024
@mikelittle
Copy link
Contributor

This looks good to me. Is there anything else to be done? Happy to approve it and get it into v19.

Copy link
Contributor

@mikelittle mikelittle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@kovshenin kovshenin merged commit 3a7aba3 into master Apr 20, 2024
1 of 3 checks passed
@kovshenin kovshenin deleted the core-6.5.0-afterburner branch April 20, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants