Closed paeddy-l closed 2 years ago
When you say "every few minutes", do you mean that the language pack update shows up again immediately, or is there actually some short time period where you can reload the update page and not get the same update?
An update showing up again immediately might indicate that there's some kind of a bug in the code that clears the update list. On the other hand, if there's a delay - even a small one - that suggests there could be something wrong with the update itself, like an incorrect PO-Revision-Date
header.
I mean that it is displayed again a few minutes after a successful update. Not immediately, but a few minutes later.
I have created the translation with Poedit. Unfortunately I don't see anywhere a possibility to store a concrete version for the translation or something similar. I just create the files, pack both (.mo and .po) as .zip and make them available for download. This then results in the problem I described. What am I doing wrong?
For this, the newly downloaded translation is placed under /wp-content/languages/plugins
and not, as I had hoped, under /wp-content/plugins/{Plugin_Name}/languages
. Is that the way it's meant to be by default, or is there a way to change it?
As far as I know, WordPress doesn't use version numbers for language packs. The last time I checked, the API had a version
field, but WordPress core didn't actually do anything with that field.
Since there are no usable version numbers, PUC uses timestamps instead. It will present a language pack as an update if the updated
timestamp in the JSON metadata is greater than the PO-Revision-Date
timestamp in the installed translation. You can find this timestamp by opening a .po
file in any text editor. You will probably see a line like this near the top of the file:
"PO-Revision-Date: 2022-06-12 12:34:56+0000\n"
For language pack updates to work correctly, the updated
timestamp should match (or exceed) this value. Maybe like this:
"updated": "2022-06-12 12:34:56+0000"
For this, the newly downloaded translation is placed under /wp-content/languages/plugins and not, as I had hoped, under /wp-content/plugins/{Plugin_Name}/languages. Is that the way it's meant to be by default, or is there a way to change it?
Yes, I think that's the default. Anyway, the update checker doesn't control the install location, WordPress core is what actually installs the updates.
If you want translations to be installed only as part of the plugin, maybe you don't need this feature at all? You could just leave out the translations
section, keep translations in your languages
subdirectory, and load them explicitly with load_plugin_textdomain
.
Thanks for the explanation.
I think it's easiest if I remove the translations
section as you suggested and provide the translations directly with updates to the plugin. That way I have less work and it's all done with one deployment.
Thanks a lot for this great project.
Sounds good. I'll close this now.
Hello,
I use the self-hosted variant of the update checker for one of my plugins. The updates of the plugin work without problems. What causes problems are updates from the language packs. I have created the language files in the folder of the plugin under "languages". If I now enter the following in the .json:
the language files are stored under "/wp-content/languages/plugins". In itself no problem, as it works just as well. Now to the problem: When I deploy a new version of the language packs, WordPress recognizes this and updates them as well, however WordPress wants to download the language packs again every few minutes afterwards. What am I doing wrong? I hope I could formulate my concern precisely. If something is unclear, please let me know. Thank you very much.
Kind regards