Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Bobby 11 months, 3 weeks ago.

Assigned support staff: Bobby.

Author Posts
September 24, 2020 at 9:20 am #7088671

andreL-14

Hi, we are using WPML with 40 languages. We have 4 duplicate instances from our website that all connect to the same database. The content of `wp-content/languages` folder is not tracked with git. We noticed that the generated content differs between our instances, some contain a `wmpl`folder, others don’t. We experience the problem that the translations are sometimes shown at the front-end and sometimes not.

In addition, we have the problem that our WordPress site is very slow. Using a query logger plugin, we figured out that a single page request fires 2500 queries, and 2000 of them are fired by the wpml-string-translation plugin.

I guess, we need to have a single storage that is shared between the 4 instances and contains the mo files, correct?

My questions are:

1. How can we create the mo files? Can we create them on a local instance with the same database and then simply upload them?
2. Will the pure presence of mo files stop wpml-string-translation to make 2000 query calls, or do we need to change settings somewhere?
3. If a user adds a translations string in the backend, does it update database and mo files?
4. Any advice how we can use caching to optimize our site with WPML?

Thank you so much for your support.

September 26, 2020 at 8:16 am #7104671

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

1. Technically you could

The .mo files are added within wp-content/languages/wpml/

I have not test this before but yes I believe you can try creating them locally and then upload them to the above directory

2. Yes, this was done so the performance can be increased by decreasing the queries

https://wpml.org/faq/cannot-write-mo-files/

3. Yes, as long as the file is writable

4. Please review the following documentation

https://wpml.org/faq/prevent-performance-issues-with-wpml/

Let me know your results, please.

September 26, 2020 at 1:27 pm #7105739

andreL-14

Thanks for your answer.

1. I will try it and let you know once it is done, this may take a while. Have I understand it correctly that a particular .mo file is only generated when you save a related string in the WP backend? This means, the mo files are not generated automatically when they are missing? And I need to create all mo files as instructed here: https://wpml.org/errata/string-translations-are-not-displayed-when-a-language-locale-is-changed/ ?

2. Alright, that is great. I hope this will stop the 2000 queries on each request. But I am still wondering, why 2000 queries are loaded without mo files? Is it possible that all language strings are requested? If so, is it possible to only load those language strings that are needed?

3. If they are written to the database, why are the strings then sometimes shown and sometimes not? I thought they may only be shown if the mo file is present in an instance, but if they are added to the DB than they should also be shown in the other instances that are not having the mo file?

4. Thank you for the link. Do you have a more in-depth documentation? It basically just states that one should use a cache plugin, but my question was how we can use caching to improve WPML performance. I.e. which plugin and settings are recommended in particular for WPML.

Thanks again for your quick response.
Have a nice weekend.

September 28, 2020 at 8:44 pm #7118601

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

By following these steps you should be able to generate all the .mo files if they were never generated. Also in WPML->String Translation at the very top you will get an option to scan for new files if any exist and have not been picked up already.

"go to the WPML -> Support -> Troubleshooting page and click the Show custom MO Files Pre-generation dialog box button. In the dialog that appears, click the blue button to regenerate custom MO files."

Also, there is no feature that will allow to only load those language strings that are needed and you can also review the following documentation on how to debug performance-related issues here https://wpml.org/faq/how-to-debug-performance-problems/, but we dont have a specific to cache documentation.

The topic ‘[Closed] How to use wpml-string-translation on multiple instances?’ is closed to new replies.