Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem: Complianz Plugin - mixed language content in generated documents

Solution: The dates are not showing translation because of a conflict in the Complianz plugin code. They have a function to localize the date(in plugins/complianz-gdpr-premium/functions.php @ line 1063). But it is not localizing the Month.

It works as expected after the following steps.

1) Go to *wp-content/plugins/complianz-gdpr-premium/* folder
2) Open *class-document.php* file for edit
3) Scroll down to line 797
4) Make the following change & save the file

From

	$date = $post_id
				? get_the_date( '', $post_id )
				: date( get_option( 'date_format' ),
					get_option( 'cmplz_publish_date' ) );
	$date = cmplz_localize_date( $date );

To

	/* $date = $post_id
				? get_the_date( '', $post_id )
				: date( get_option( 'date_format' ),
					get_option( 'cmplz_publish_date' ) );
			$date = cmplz_localize_date( $date );
	*/
	$date = get_the_date( '', $post_id );

Relevant Documentation: https://wpml.org/forums/topic/complianz-plugin-mixed-language-content-in-generated-documents/#post-11373039

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 13 replies, has 2 voices.

Last updated by kellyL-9 1 year, 10 months ago.

Assisted by: Bigul.

Author Posts
May 26, 2022 at 2:54 pm #11317595

kellyL-9

Generated documents have mixed languages.

In the attached example, only the month is in English (the doc is in Portuguese).

But it happens in other places.

I have found similar questions in the forum, but the link is hidden.

Thanks.

imagem_2022-05-26_115240430.png
May 26, 2022 at 5:03 pm #11319313

Bigul
Supporter

Languages: English (English )

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

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

Please visit WPML>>String Translation and check the string *May* is translated to Portuguese. If not, please translate it and make sure it works or not.

In some cases, it is possible that those strings have been recognized but not associated yet with the String Translation panel for the translation. Please visit WPML>>String Translation and click on the *Translate texts in admin screens »* link at the bottom of the page.

Then search for the missing strings in the *Admin Texts Translation* screen and check whether it is listed or not. If so, please add it for translation and translate it.

Refer to this doc for more details - https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#strings-arent-selected-for-translation

--
Thanks!

Bigul

May 26, 2022 at 10:42 pm #11320871

kellyL-9

Hi,

There is no string "May" in String Translations and I don't think it is the case.

The Complianz Plugin automatically insert the date. Programatically it is not a string.

But I have chosen Complianz plugin because it is listed as compatible with WPML.

I have found some topics in forum with similar problem and the support shared a guide of how to install Complianz plugin and but in all topics the link is hidden. Do you know this link?

Thanks

May 27, 2022 at 7:26 am #11323075

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the updates. This requires further checking. So a couple of requests. Please share the following information.

1) Please let us know the exact steps to reproduce the issue on your site

2) Please fill the private details fields after a full site backup. I would like to access the admin area.

Please refer to the following links for more details about our private information sharing policies.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

hidden link

--
Thanks!

Bigul

May 28, 2022 at 4:04 pm #11334171

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the details and login information. I have two doubts.

a) Please describe more about the following for a better understanding. It will be great if you can share the correct result for it.


2) Article 6 - Table of Cookie is totally mixed

b) Hope you are mentioning the *Block C,* and *2nd floor,* strings of the address. Please check the attached image.


3) Article 7 - The address of the Brazilian Data Organization is in English

Also, please allow me to make a duplicator copy of your site using the Duplicator plugin(https://wordpress.org/plugins/duplicator/) for debugging the issue on my local server.

--
Thanks!

Bigul

2022-05-28_21-33-34.png
May 30, 2022 at 2:36 pm #11345367

kellyL-9

Hi,

I got a nice feedback from Complianz support and in fact, some content are in english and shouldn't be.

But I still got an issue. The Month name in the top and in the footer of the document are in english and it should be in portuguese.

Look the attatchment highlighting in my website

Look the test link from the Complianz Support: hidden link

They said my problem could be core translations outdated, but everything is up-to-date.

imagem_2022-05-30_113628429.png
May 31, 2022 at 5:03 pm #11355991

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the updates. I made a copy of the site and checking it now locally, will get back to you as early as possible. Please wait.

--
Thanks!

Bigul

June 1, 2022 at 8:52 pm #11365943

kellyL-9

Thank you, I wait your return!

The insta site created by Complianz support hidden link will be avaiable for 14 days since from when they created it.

June 2, 2022 at 12:21 pm #11373039

Bigul
Supporter

Languages: English (English )

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

Hello,

The dates are not showing translation because of a conflict in the Complianz plugin code. They have a function to localize the date(in plugins/complianz-gdpr-premium/functions.php @ line 1063). But it is not localizing the Month.

I am getting the expected result in local copy after the following change in the code. You can try this on your site after a full site backup.

1) Go to *wp-content/plugins/complianz-gdpr-premium/* folder
2) Open *class-document.php* file for edit
3) Scroll down to line 797
4) Make the following change & save the file

From

	$date = $post_id
				? get_the_date( '', $post_id )
				: date( get_option( 'date_format' ),
					get_option( 'cmplz_publish_date' ) );
	$date = cmplz_localize_date( $date );

To

	/* $date = $post_id
				? get_the_date( '', $post_id )
				: date( get_option( 'date_format' ),
					get_option( 'cmplz_publish_date' ) );
			$date = cmplz_localize_date( $date );
	*/
	$date = get_the_date( '', $post_id );

So please contact the Complianz plugin team about this and let us know their feedback. Refer to the attached images for more details.

--
Thanks!

Bigul

2022-06-02_17-40-40.png
2022-06-02_17-39-42.png
2022-06-02_17-38-51.png
2022-06-02_17-37-08.png
June 6, 2022 at 4:22 am #11392399

kellyL-9

Hi!

I appreciate your investigation, but I'm sorry to say the solution solves the issue partially only.

I modified the plugin as you suggested and it in fact loads the translated date, but it does not load the expected date.

This plugin has a feature which whenever you regenerate the Legal Document by the assistent service, it saves a kind of date in a different variable other than the default post/page date. Check my screenshot. So the solution translates the date but does not load the intended date.

But I think you have helped me to find the bug and the solution.

It is a issue with date format, I will detail it later!

June 6, 2022 at 8:07 am #11393459

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the feedback. The date format is generated by the Complianz plugin and it will be the same if WPML is inactive. Therefore it will be great if you can consult about this with the plugin team. Thank you for your understanding.

--
Thanks!

Bigul

June 6, 2022 at 1:30 pm #11396513
kellyL-9

Detailing:

The 2 pieces of code you screenshot helped me to investigate the issue.

Their function relies on "strtotime" and it doesn't parse non english formats. When we use the default Brazilian date format, which is "j \d\e F \d\e Y" we get the problems.

We didn't notice it their test site because they kept data english format and it worked.

So I modified the function cmplz_localize_date to get the date in both formats in english and in brazilian (actually in whenever format wordpress is using) and it worked.

I addressed the solution to Complianz team and I hope they fix it in the next update. So you actually helped to find the solution! Thank you very much!

-------

Can I take advantage of this ticket to ask another 2 questions about WPML?
1) While trying some alternative solutions to the problem above, I was experimenting in php with ICL_LANGUAGE_CODE and the Complianz add_filter. It was not working. I was putting it in my custom plugin, but by the time the custom plugin was executed, I guess the ICL_LANGUAGE_CODE was probably not set up yet. So do you know how is the right way to check for that variable in my custom plugin?

I was just trying to do:

if(ICL_LANGUAGE_CODE == 'pt-br'){
//complianz add_filter(...);
}

2) And what if I want to create my custom strings translatable in WPML? Do I have to create the whole .PO/.MO files and register everything or there is a simpler way todo it with WPML?

Thank you

June 6, 2022 at 3:43 pm #11397485

Bigul
Supporter

Languages: English (English )

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

Hello,

Thank you for the detailed feedback. Happy to know you are getting the expected results now.

Please note that I have opened new tickets for the Other two questions. Because as per our support policies, we can only handle one issue per ticket. It will help us to serve you better and we can avoid discussing multiple problems in one ticket. Also, it will help other users with similar problems find solutions when searching the forum. I will get back to you soon on the latest ticket. Please wait. Thank you for your understanding.

--
Thanks!

Bigul

June 6, 2022 at 6:45 pm #11398597

kellyL-9

Thank you very much, Bigul!
I'm sorry for having addressed to you the Plugin problem, but in context I was pointed to think it was a WPML issue.
But you surely helped a lot! Thanks!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.