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 20 replies, has 3 voices.

Last updated by Bruno Kos 5 months ago.

Assigned support staff: Bruno Kos.

Author Posts
April 16, 2019 at 3:12 pm #3623303

roelv-14

Dear,

We are trying to create a simple custom plugin with .mo translation files. When I'm testing without any of the WPML plugins, it looks like it is working correctly and I'm getting the correct translation back.

When I'm turning on the WPML Multilingual CMS and WPML String plugins, I checked the option within Theme and plugins localization: Translate themes and plugins using WPML's String Translation and always load .mo files as backup and scanned the plugin for strings. It says there are 7 strings in it which are not translated and when I check the strings there aren't any translations added.

Are these only picked up now from the .mo files, or I'm missing something?

Best regards,

Martijn

April 16, 2019 at 10:46 pm #3625907

Bobby
Supporter

Languages: English (English )

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

Hello,

as long as the .mo file is available and the setting is enabled the translations should be pulled through the .mo files and show in the front end?

are you able to see them in the front end ?

additionally you can go to WPML->String Translation-> import .po files to manually import translations to already picked up Strings

https://wpml.org/2010/06/theme-and-plugin-translation-wpml-or-mo-files/

let me know your results please

April 17, 2019 at 7:20 am #3627693

roelv-14

Dear,

The translations are needed in the admin and when I turn off WPML it's all working correctly. Switching between languages shows the correct language.

When I turn back-on WPML it's messing up again, showing the default website language instead of the currect selected language in the user profile. (I also checked the option "Set admin language as editing language.")

When I imported the .po files manually it's working correctly, but because of an automated process and deployment this isn't a working solution for us.

April 17, 2019 at 10:14 pm #3634945

Bobby
Supporter

Languages: English (English )

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

Hello,

if possible i would like to take a closer look at the plugin in question and the area where i can see the issue at the moment with the .mo files

**Before we proceed I recommend to please take FULL BACKUP of your database and your website.**
I often use the Duplicator plugin for this purpose See: http://wordpress.org/plugins/duplicator/

I would like to request temporary access (wp-admin and FTP) to your site

You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you will enter is private which means only you and I can see and have access to it.

Thank you,
Bobby

April 18, 2019 at 7:58 am #3636957

roelv-14

Dear,

We develop and test on local servers which don't have access from outside, so I can't give you any temporary access.

I can give you an archive with the testing setup if you want, so you can test it yourself.

Best Regards,

Martijn

April 18, 2019 at 7:47 pm #3641693

Bobby
Supporter

Languages: English (English )

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

Hi Martijn,

that could work , i would test it on my local testing environment therefore please just provide me with information on how i can see the issue and where i can see it.

if this is a plugin , you can simply just provide me with the plugin and i will be able to test it

you can share this information on the following private field

April 19, 2019 at 8:50 am #3644187

roelv-14

Hi Bobby,

hidden link

In the wetransfer link I've added 3 plugins (I don't know how to upload them here):

- Onlinepets: Auto Login
- Onlinepets: Nice error message
- JWT Auth plugin

The auto login plugin needs the JWT auth plugin for working. So when you activate the auto login and haven't activated the JWT plugin, it will throw a translated error message. The same way if you have both plugins activated and deactivate the JWT plugin first, you will get an error.

The nice error message plugin isn't needed but it gives you just a bit more styled error message.

I can reproduce the error by switching from language in the admin and just throw up the error.

If it's needed, I can send the complete setup including WordPress and WPML settings also.

Best Regards,

Martijn

April 22, 2019 at 7:52 pm #3658075

Bobby
Supporter

Languages: English (English )

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

Hello,

The plugins i noticed have the .mo files in the languages folder but the .po files are missing
which is the major difference between them and another plugin that is working as expected in the backend admin when the language changes

.mo stands for Machine Object
-- compiled export of the .po file which is used by WordPress

if possible please use something like poedit to add a test translation including the .po file within the languages folder and let me know your results

April 23, 2019 at 9:00 am #3660981

roelv-14

Hi Bobby,

Still no luck with the translations. I added the .po files and .pot file, but translations are still messing up.

I also added back the 'Domain path' in the plugin file.

If you want, I can provide a full copy for you for testing?

Best regards,

Martijn

April 24, 2019 at 1:54 am #3668167

Bobby
Supporter

Languages: English (English )

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

Hi Martijn ,

that would be great! also please make sure that the copy includes the .po files so i can further test it

i have enabled the private field reply

April 24, 2019 at 6:44 am #3669563

roelv-14

Hi Bobby,

I have used you're recommendation to use duplicator for the backup:

hidden link

It has the .po and .pot file in it for the autologin plugin. I have used poedit for the translation files.

Best regards,

Martijn

April 25, 2019 at 7:56 am #3679755

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Bobby is currently on a vacation, so I am stepping in. I am wondering whether it would be the easiest for us to understand the issue - and possibly escalate - if you create a minimal setup on our Sandbox, where you would set this plugin and describe step-by-step on what we need to do to:

- see the issue
- test (working vs non-working)
- what are expected results

And perhaps provide images along with it?

Regards,
Bruno Kos

April 25, 2019 at 8:40 am #3680161

roelv-14

Hi Bruno,

I've installed the most minimal version I use to check, default language is Dutch.

- See the issue:

Try turn off the 'JWT Authentication for WP-API' plugin when the 'Onlinepets - Auto login', you will get an error message which say's you can't turn of the plugin because our plugin needs it.

- Expected:

When I turn to the French language in the back-end, the error must show the French translation instead.

- Results:

The Dutch translation is shown instead of the French translation.

(The translations are also included for the plugin name / description, these are also not translating while switching)

I've included an image to show the problem. And it's also weird that the other plugin is translating correctly (Onlinepets - Nice error message)

Best regards,

Martijn

April 25, 2019 at 1:57 pm #3683111

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I can see the issue. Question:

So when you activate the auto login and haven't activated the JWT plugin, it will throw a translated error message

Is this message coming from jwt-authentication-for-wp-rest-api plugin? I don't see mo and po files within. Or is this message coming from some other plugin that are connected to this one?

There is one thing to try - e.g. download plugin such as https://wordpress.org/plugins/christmas-music/, try experimenting with its po and mo files and perhaps emulate what they did to make it work.

When testing that, make sure to have Theme and plugins localization -> Translate themes and plugins using WPML's String Translation and always load .mo files as backup.

Regards,
Bruno Kos

April 26, 2019 at 11:43 am #3690439

roelv-14

Hi Bruno,

No, the 'Onlinepets - Auto login' is throwing the error. That is our own plugin and has translations files in it (.pot, .po and .mo)

I tried different options for the translations and looked at multiple plugins to get the correct code syntax, but I can't understand why it's not activating correctly.

OP-nice-error-message is also our plugin and that translations are working as expected in on the plugin overview page.

Best Regards,

Martijn