Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tim W

    (@timwhitlock)

    Short answer: Yes. Longer answer will depend on its progress into WordPress core.

    Below is what I sent to someone about a month ago who asked me if I’d be supporting the PHP translation file format. Things may have changed since then, but I have not revisited the plugin since some updates.

    From what I can tell, it’s basically a? caching layer for any MO that gets loaded. That cache being a PHP file that get’s parsed when it exists, and invalidated when the MO file changes.

    For this reason it doesn’t look like my plugin needs to support the PHP file format, as such. I tested it quite briefly, but the cache works with files in Loco Translate’s custom folder, and invalidates them when changes are made. This works, because the cache seems to operate on any MO file individually, rather than attempting to aggregate them. So that’s good.

    The only thing I noticed was that when deleting a translation file via my plugin, the cached PHP file would need deleting too. I’ve added temporary support for this in the development branch, which you are welcome to test. This unfortunately meant an exception for the security rules in my plugin, which disallow writing of PHP files (including deleting them). I can see the speed and simplicity benefits of using PHP code for a caching layer, but I think it raises potential security problems. It would work the same without using a .php file extension, but that’s for the Core team to decide.

    There are also some issues with the performant-translations uninstall script. This will only remove files from the standard locations, so I would need to add my own uninstall hook to remove any caches of custom MO files. This is doable, but I’m going to hold fire for now as I expect there will be changes before this makes it into core.

    Plugin Author Tim W

    (@timwhitlock)

    So it looks like it will be in Core 6.5 in a month’s time. I’ve only looked at this in its earlier plugin form. I’ll take a look at the 6.5 branch in due course.

    Thread Starter asafm7

    (@asafm7)

    That’s great, @timwhitlock.

    Thanks for the detailed response.

    Plugin Author Tim W

    (@timwhitlock)

    With WP 6.5 coming in a couple of weeks, I’ve made some changes since my comments earlier. The current dev version has been tested on 6.5-RC2-57828 with and without the performant translations plugin.

    Despite my comments earlier, it has become clear that WordPress Core will not generate PHP translation files. They are now installed from GlotPress alongside the PO and MO files.

    Lazy generation of these files would still require the Performant Translations plugin, so I’ve now added PHP file generation into the Loco Translate compiler.

    It seems that no fixes are required for Loco Translate’s file loading helper (which merges custom translations on top of installed ones). Fortunately, this just works as is.

    I’ll make a release shortly before WordPress 6.5 is released, in case there are any teething problems. However, if you’re running a WP6.5 preview, then please test the current dev version of Loco Translate.

    Thread Starter asafm7

    (@asafm7)

    That’s great. Thanks for the update @timwhitlock.

    Plugin Author Tim W

    (@timwhitlock)

    Loco Translate 2.6.7 has gone live with support for WordPress 6.5.

    I’d be grateful for any feedback, as 6.5 will land soon.

    Thread Starter asafm7

    (@asafm7)

    Thanks @timwhitlock.

    I just updated. So far it looks good, but I haven’t upgraded to WP 6.5 yet.

    I will let you know if I come across any issues.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘The New WordPress Performant Translations and Loco’ is closed to new replies.