[Resolved] String translation issues on product page
This thread is resolved. Here is a description of the problem and solution.
Problem: The client reported that certain hardcoded strings on their product page were not translating, despite having translations available. Additionally, content in the Information tab was not displaying correctly. Solution: 1. To address the display issue in the Information tab, we added the following CSS to the custom CSS section of the theme:
This change ensured that the tab content is now visible in all languages. 2. For the hardcoded strings on the product page, such as 'Code du produit', we took the following steps: - Enclosed the strings within the gettext __() function in the functions.php file of the child theme, changing 'Code du produit' to:
__('Code du produit', 'savoy-child')
- Scanned the child theme using WPML's Theme and plugins localization feature. - Located the string on the WPML String Translation page and added its translation. For more details on translating themes, you can refer to this documentation: Translating the Theme You Created 3. A separate issue related to manually translating product details has been addressed in a new support ticket.
If this solution does not resolve your issue or seems outdated, we recommend opening a new support ticket. We also advise checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, please visit our support forum at WPML Support Forum.
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.
Some lines that were encoded for me by a programmer don't seem to translate (In the screenshot, there are "Code du produit", "Quantité par caisse ou palette" and "Prix de détail suggéré" on the product page), even thought I did translate the strings....
Maybe it'd be easier if you could access my site. I have a temporary user plugin I could link you with if you want to.
Thank you for your time again.
New threads created by Noman and linked to this one are listed below:
Thank you for contacting WPML Support. To take a closer look at this issue, please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site), so that I can look into your setup and debug the issue.
I’ve enabled a private input box for your next reply.
=== Please backup your database and website ===
✙ I would additionally need your permission to deactivate and reactivate Plugins and the Theme and to change configurations on the site. This is also a reason the backup is really important.
✙ Please provide me an example product link where I can see this issue.
1. For the Information tab, I've examined the source code and noticed that the content was already there but it was hidden using a CSS, so I've added the below CSS in custom CSS section of the theme:
And now information tab content shows correctly in both languages.
2. For translating the hardcoded strings on the product page, I've followed the below steps:
- Wrapped the strings in the gettext __() function by replacing the below string:
Code du produit
With:
__('Code du produit', 'savoy-child')
From functions.php file of the child theme.
- Scan the child theme from WPML >> Theme and plugins localization page.
- Went to WPML >> String Translation page, searched the string and added the translation and now it seems to be showing the correct translation at frontend.
Noman, you are an absolute king! What a job you just did! I used some of the tricks you highlighted in your last reply and was able to fix a few additional strings I couldn't translate before and it worked!
The only strings left, as far as I can see this morning are in the Checkout Page and were coded by someone else. I don't know where to look for to translate, WPML doesn't seem to see them even tough I went into the "Choose texts for translation" section.
There's only 3 lines, there's the "récupérer chez Anidis", which should be "Pickup at Anidis" in english, and below that the "Numéro de PO du client" which should be "Customer's PO number" and finally the line "Entrez votre no de PO (optional)" which should be "Enter your PO number".
If you can let me know how to find these and translate them, we will be done for the string translation mysteries.... and we could proceed with the new thread you created for the manual product translation...
Thanks a million again!
New threads created by Noman and linked to this one are listed below:
If the string translation issue on product page is solved, please mark this ticket as resolved and we will continue working on the above ticket for it.