Home›Support›English Support›[Resolved] change the original string in english and the translation in french
[Resolved] change the original string in english and the translation in french
This thread is resolved. Here is a description of the problem and solution.
Problem:
The client needed to change a hardcoded English string and its French translation within a plugin file. Solution:
1. We located the hardcoded text in the plugin file at
on line 776.
2. We edited the file to change the text to 'You can add a maximum of %1$s %2$s's. You already have %4$s.'
3. We scanned the plugin 'advanced-product-quantity' in WPML -> Theme and plugins localization, which added the edited string under the domain 'addify-product-qty'.
4. We translated the string to French as 'Vous pouvez ajouter un maximum de %1$s %2$s's. Vous avez déjà %4$s.'
5. We advised the client that since the text was changed directly in the plugin file, any updates or replacements of the plugin would override this change. We recommended contacting the plugin author to request a feature in the wp-admin for customizing this text.
Please note that this solution might not be relevant to your case, as it could be outdated or not applicable. If this doesn't resolve your issue, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.
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.
Tell us what you are trying to do?
change the original string in english and the translation in french
Is there any documentation that you are following?
All the cases I saw indicate to change the default language of the string but I can't in the same time to change the french translation
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
Can you please check if you can find the string search for it inside WPML -> String Translation?
Then you can select it and change its language in the bottom of the strings table.
Then you'll be able to edit the translation. For you to edit the original string, you'd need to locate where it comes from and change it directly in there.
When searching for the string inside String Translation you mark the option 'include translations' for you to have more results.
I saw these recommandations in others cases. But it doesn't work like that :
1) I change the default language
2) I can now modifying the orignal text in english
3) BUT automatiquely the new french value ot the string become the oldest value of the string in english !
-> So the english is correct but not the french !
4) I change again the default language of the string and the oldest value of the french string (the original english string) become the value of the english string and I return to the first step !
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello,
Can you give me an example of a string where this issue happens?
Also, I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Our Debugging Procedures
I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Please, let me know if you need any additional details. Have a nice day.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
I checked it and that text is hard coded in the file wp-content/plugins/advanced-product-quantity/includes/class-af-a-q-main.php in the line 776.
I edited this file and changed the text so it looks like you mentioned:
'You can add a maximum of %1$s %2$s's. You already have %4$s.'
After that I scanned the plugin advanced-product-quantity in WPML -> Theme and plugins localization. Then that edited string as added under the domain 'addify-product-qty'. I translated it to 'Vous pouvez ajouter un maximum de %1$s %2$s's. Vous avez déjà %4$s.'.
Now when I check the front end, both texts are showing up as expected, please check the screenshot.
Obs.: Please notice that I had to manually change the text directly in the plugin, if you update the plugin or replace it with a fresh copy this change will be overridden, I'd recommend you getting in touch with the plugin author to add a place inside the wp-admin where you can customize this text.
Thank you, please check it if it looks OK and let us know.
Mateus
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
It's my pleasure to help.
Regarding your questions, based on your description of the issue, given that the strings has the domain name 'addify-product-qty', it helped me identify that it came from the plugin advanced-product-quantity.
I used a file manager plugin, that I removed afterwards, to look for where this string was coming from to attend your specific request.
Please let us know if you need further help with this.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Given the fact that I needed access to the files to be able to both debug and find a fix for this issue, I used this plugin for this task: https://wordpress.org/plugins/wp-file-manager/
It was removed the moment I finished working on the site.
Since the original issue has been resolved, I hope we are good to close here.
Feel free to contact us any time if you need assistance with our products.