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
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. 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.
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.
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.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.