wearerequired / traduttore

🗼 A WordPress plugin to improve the I18N workflow for your own projects based on @GlotPress.
https://wearerequired.github.io/traduttore/
71 stars 15 forks source link

Serve language packs depending on requested version #140

Open ocean90 opened 5 years ago

ocean90 commented 5 years ago

Issue Overview Since #133 the version of the theme/plugin is used for the version field in the API. But the actual download URL is still the same for all versions.

Expected behavior The path to the language pack includes the version of the language pack.

Additional context WP.org API: https://api.wordpress.org/translations/themes/1.0/?slug=twentynineteen

swissspidy commented 5 years ago

Should we try to expose all possible versions via the API?

ocean90 commented 5 years ago

Good point. Only the latest version which match the requested version actually. Examples:

https://api.wordpress.org/translations/themes/1.0/?slug=twentyseventeen&version=1.0 (only 1.0) https://api.wordpress.org/translations/themes/1.0/?slug=twentyseventeen&version=1.8 (1.0-1.8, depending on availability)

swissspidy commented 5 years ago

That means we should make the version number a part of the file name or put them into folders like on WordPress.org. The latter is probably easier

Either way, I think we should add a CLI command to remove old files that can be run when upgrading. It would basically do half of what uninstall.php does.

swissspidy commented 5 years ago

Either way, I think we should add a CLI command to remove old files that can be run when upgrading

We could extend wp traduttore cache clear for that.

For running the complete uninstall routine there is wp plugin uninstall.

swissspidy commented 5 years ago

Only the latest version which match the requested version actually. Examples:

Hmm, sounds like we need to store a list of language packs per project in gp_meta or something. Otherwise we have no idea what kind of files there are on the server.