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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Africa/Cairo (GMT+03:00)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Osama Mersal 1 year, 7 months ago.

Assisted by: Osama Mersal.

Author Posts
November 1, 2023 at 4:05 pm #14709021

adamM-10

Hello ,

Now that the string is imported, it is only displayed translated when "Look for strings while pages are rendered" is checked.

I have updated hidden link to demonstrate this issue. Both strings in the footer should have FRENCH before them. If you turn on "Look for strings while pages are rendered" the second will now have FRENCH before it.

Steps to recreate this issue from scratch:

- Delete import_test domain strings from string translator.
- Turn on auto register strings for translation filtered to import_test domain
- View homepage
- View added strings in string translator
- Import PO file containing french translation with escaped strings with also create translations checked - hidden link
- CONFIRMED - String is now matched and original has escaped characters
- CONFIRMED - String appears as translated in the admin
- Turn off look for strings while pages are rendered
- ISSUE - View homepage and string is not translated
- Turn on look for strings while pages are rendered
- View homepage
- ISSUE - String appears as translated

Any ideas on what is causing this?

November 5, 2023 at 9:29 am #14732491

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply due to a higher workload. I've consulted our 2nd tier support regarding the issue and will update you as soon as I get their reply.

Thanks for your patience

Best regards,
Osama

November 7, 2023 at 12:40 pm #14747071

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your patience. Our 2nd tier support team has found a workaround for the issue. Kindly check the following steps:

1- Edit the (wp-content/plugins/wpml-string-translation/classes/po-import/class-wpml-po-import-strings.php) file: Line 42
2- Replace the following line

 
$original = wp_kses_post( $string->original );

with

$original = ( $string->original );

3- Delete the strings
4- Scan the plugin
5- Import the strings

I've applied the above steps to the sandbox site. Please check if it works correctly.

Best regards,
Osama

November 13, 2023 at 8:32 pm #14792199

adamM-10

Hello Osama,

Looking at the source code, the imported strings do not contain the escape characters. As mentioned in the original ticket to work with JSON, the quotes need to be escaped.

Please have the team review review.

November 14, 2023 at 8:15 am #14794509

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please clarify more to help me understand your reply better so I can check with our 2nd tier support team.

Also, please let me know if the provided workaround fixed the issue for you or not.

If you need another sandbox site to demo the issue with the workaround, please let me know to create one.

Thanks,
Osama

November 15, 2023 at 5:49 pm #14819589

adamM-10

Please review the previous thread for clarification on the escaped strings:
https://wpml.org/forums/topic/string-translate-not-displaying-imported-strings/page/2/#post-14672793

Please also provide me the link to login to the sandbox, I can no longer pull it up in the previous thread.

November 16, 2023 at 8:24 am #14822731

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Here is a new sandbox site because the old one is expired. (hidden link)

Best regards,
Osama

The topic ‘[Closed] Strings only work with 'Look for strings while pages are rendered' enabled’ is closed to new replies.