YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.22k stars 403 forks source link

plugin language packs #511

Open liedekef opened 1 year ago

liedekef commented 1 year ago

Hi,

the code works fine for me, thanks for that. Any hints on how to also automate language updates via github? The regular plugin updatae works fine, so should I just add language assets of some kind to the release?

YahnisElsts commented 1 year ago

That feature currently doesn't exist for GitHub/Bitbucket/etc repositories. Right now, the update checker doesn't make any attempt to find language packs among release assets or in the repository itself.

In principle, I wouldn't be against such a feature being added, but I'm not sure if there is an established way to distribute translation updates via GitHub.

liedekef commented 1 year ago

Well, a suggestion for github would be: when working with releases, create an extra asset for the languages that have changed (I'm not sure if WP uses zip files for languages though). The code can then search for it as it does on WP: use the plugin name + installed language codes as filter (of course those then need to be ignored when searching for the release itself). You could even imagine searching for "pluginname.zip" as a default asset (if assets are enabled), making it even esier for users.

YahnisElsts commented 1 year ago

For what it's worth, I can confirm that WordPress uses ZIP files for language updates. PUC already supports translation/language pack updates for plugins that use the custom JSON-based metadata format.

liedekef commented 1 year ago

So, that would mean you'd only need to generate that json based on available language files then (if based on the plugin name) :-)

YahnisElsts commented 1 year ago

It wouldn't be quite that simple, but essentially yes - generate and/or retrieve that data structure.