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.