Translation files of Events Calendar Plugin stored twice
Grüss dich Oliver,
That is an excellent question you posted there, thank you for it. I’ll try to set this straight for you to clear away the confusion and make your work easier and less frustrating in the future.
This is where our plugins contain the original language files. Whenever you update The Events Calendar, the newest translation files will be downloaded here, and thus the old ones will be overwritten. So if you made any modifications in the .po/.mo files in this folder, those modifications will be lost after an update.
This is where you can store you own language files that override the ones in the wp-content/plugins/the-events-calendar/lang folder. So if you have a .po/.mo here, then the one in the folder of the plugin itself will not be used.
Thus, if you have custom translations it is recommended to keep them in wp-content/languages/plugins, because this way 1) that will be the one that is used; 2) it will not get overwritten with a plugin update.
Now, what happens / what can you do when the plugin receives new strings or some strings are modified with a plugin update?
You can update the .po/.mo files in the wp-content/languages/plugins folder from the .pot file that is in the lang folder of the plugin.
Since you use PoEdit I guess you know how this works, but for other’s here is the process.
Updating .po/.mo language files with PoEdit:
- Download the .po file to your computer and open it with PoEdit
- From the menu choose Catalog > Update from POT file …
- The new strings will be added, unused strings will be removed, modified strings will be updated
- Save your .po file
- Upload your .po and .mo file to wp-content/languages/plugins
Updating .po/.mo language files with Loco Translate
- Log in to your Dashboard and go to Loco Translate
- Click on the appropriate plugin
- Click on the appropriate language
- Click on the “Sync” button
- If all goes well you should see a success message: “OK: Already up to date with plugin-name.pot”
This is it.
For some further info on translation I recommend these readings:
I hope this clarifies. Let me know if you have any more questions regarding this, I’m happy to help.
thanks for the explanation. That helps for a better understanding.
But unfortunately my experience is different from what you stated above:
When installing a new version of the TEC plugin, the languages files are overridden/created in BOTH directories. Please have a look at the screenshots. They have a timestamp from May 5th/7th, but I definitely haven’t touch them by myself (and I just checked our test-, staging and productive system to be 100% sure – all the same result). So it looks something in the (WordPress translation) update mechanism is copying the files there…
I ran the following test now:
I will be referring to these:
- plugin folder: wp-content/plugins/the-events-calendar/lang
- WP folder: wp-content/languages/plugins
So the test
- downgrade to TEC 4.4.5
- deactivate all other plugins (to remove clutter)
- delete all translation files from wp-content/languages/plugins
- set the site to a different language than English (I used Hungarian)
- add a translation to one of the strings in the plugin folder
- check frontend
- => translates fine
- add a different translation to the same string in the WP folder
- check frontend
- => translation is taken from the WP folder
- run update of languages at Dashboard > Updates
- => missing language files for all my plugins are downloaded (including deactivated plugins); BUT the Hungarian TEC language file in the WP folder is untouched
- run update of TEC 4.4.5 to 4.5.1
- => language files in plugin folder are overwritten (with the update all plugins files are deleted and unzipped from the new package); thus the previously translated string disappears from the plugin folder
- language files in the WP folder are not touched so my custom translation stayed in place
So far everything seems to be working fine. Maybe I need to leave this untouched now and wait for another version update.
It also can be that when WordPress is checking for the language updates and sees a newer file date in the repo (because strings have been removed / added / changed) – newer file date in repo vs your local – then it downloads it thinking it’s a more complete one. And so it overrides your.
But this is just a though I would need confirmation if this is what happens.
What can be done against this? Tough one, but I have some ideas.
- Create a backup of the language files before updating and if it changes you can put them back / merge them somehow.
- I believe with Loco Translate there is a third folder you can use: languages/loco/plugins/the-events-calendar-<locale>.po
This is likely not touched by any updates so might be the best place for the language files. But for this you need the Loco Translate plugin to be active.
- When you have a new translation, add it to the repo (WP for the free plugins or our repo for the premium plugins.)
I’d be happy to hear your thoughts.
thanks for your effort in testing this so detailed! I really appreciate this!
I pick the idea about the WordPress update process:
1. I updated the translation of the TEC plugin on the WordPress site on May 7 around 14:00 (I’m the official translator of the German translation 😉
2. The update was available in the WordPress Dashboard around 3 hours later (pretty fast) => the timestamp of the files in the plugins directory is May 7 16:58.
Therefore I expect that the WordPress update process is the reason for the override!
Independently from that the question: do you know what the trigger for the WordPress website to sent out a “message” to the Dashboard, that a translation is available? Sometimes it takes hours, sometimes days or weeks?!? If we know the trigger, I can make some dummy changes to the translation and we can verify if the timestamp changes.
It looks like then that the timestamps of the WP folder files and the repo files are compared, and if the repo is newer, then an update is pulled.
As for the trigger, unfortunately don’t know. Usually when I go to Dashboard > Updates and hit the “Check” button, then gives me if any update is available.
Apart from this I believe there is a cron job set up in WordPress – which is triggered by a visit to the site or the Dashboard – which then checks if any updates are available. If I remember correctly that cron is set to run twice a day, but I’m not quite sure about this.
Does this help?
The trigger has been pulled: Today I got a message in the Dashboard that there are new translations for TEC.
I installed it and this time the files have only been updated at
The files at
It looks like your statement about the locations is right (even I don’t understand why it didn’t worked as expected during the last update).
Oliver, thanks for sharing that. I’m happy to hear it worked out now. Let’s hope it will still work like this in the future. 🙂
I am going to close this ticket, but as you know, if you need anything else related to this topic or another please post a new one in the forum and we will be happy to help you out.
PS: We’d be grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Danke! 😉
The topic ‘Translation files of Events Calendar Plugin stored twice’ is closed to new replies.