• Resolved denisgomesfranco

    (@denisgomesfranco)


    Hello. I noticed that some of my translations weren’t being applied anymore when I uploaded .po/.mo files to my sites, so I went to investigate further and found out that WordPress 6.5 now incorporates performant translations.

    According to what I read, WordPress now converts certain translations to .php files, which then speeds up things. So now when updating a translation on my other sites, I have to upload three files: .po, .mo and .php.

    And my question is: Loco Translate allows us to download .po and .mo files but not the .php file. So, a button to download the .php file would be useful.

    This is because I don’t use Loco Translate on the sites themselves, I have set up a separate WordPress instance just to use Loco Translate, which then I use to work on translations. After I’m done, I download the compiled translation files and then upload them to the websites.

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

    (@timwhitlock)

    Thanks for pointing this out. I had forgotten about those buttons.

    For completeness, yes – I should add a .l10n.php download to go along with the .mo download. However, WordPress also uses multiple .json files in their language packs (since WP 5). While some plugins have no JSONs, others have a lot. (e.g. WooCommerce has about 180). I obviously can’t provide all of this as a download button.

    So, thinking about this for the first time now, the MO button should really be replaced with a .zip download as per the official language packs. It would contain the PO, MO, PHP and all the JSONs. What do you think?

    Regarding your immediate problem of getting the PHP files. If you install the linked Performant Translations plugin on your live site, this will automatically convert the MO files as needed. Effectively acting as a cache. WordPress on its own won’t do this.

    Thread Starter denisgomesfranco

    (@denisgomesfranco)

    When updating translations on other sites I don’t upload JSON files. So I hope I am not missing something LOL.

    Yeah, a ZIP package would be awesome if possible, thanks!

    As for the plugin, I didn’t install it on my sites. I just briefly read about this translation issue and then didn’t give it much attention until the last few days where I saw some PHP files in the languages directory. I don’t know if these files were converted automatically by WordPress 6.5 or if these came from a plugin update. In any case, not all plugins seemed to have these PHP files.

    Plugin Author Tim W

    (@timwhitlock)

    I’ll look at the zip feature today, and post back when in it’s in the trunk.

    JSON files are only required if the plugin uses wp_set_script_translations. See https://localise.biz/wordpress/plugin/manual/json

    WordPress won’t generate the .l10n.php files, but the updater will install them from GlotPress archives. That should apply to all plugins equally, but perhaps older language packs don’t have them until they’re updated. I’m guessing.

    Plugin Author Tim W

    (@timwhitlock)

    The latest dev version has a ZIP button in place of the MO button.

    This requires PHP’s zip extension. I’ve not played around with the PclZip polyfill bundled with WordPress, but this is a progressive enhancement. If the zip extension isn’t installed, the old MO button appears anyway.

    I’m marking this as resolved, but feel free to feed back.

    Thread Starter denisgomesfranco

    (@denisgomesfranco)

    Thanks a lot, @timwhitlock ! Keep up the excellent work! ?

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