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
wp-content/plugins/advanced-product-quantity/includes/class-af-a-q-main.php
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.
Tagged: Not WPML issue
This topic contains 10 replies, has 2 voices.
Last updated by Mateus Getulio 7 months, 3 weeks ago.
Assisted by: Mateus Getulio.
Author | Posts |
---|---|
April 2, 2024 at 11:13 am #15472374 | |
christopheG-16 |
Tell us what you are trying to do? Is there any documentation that you are following? Is there a similar example that we can see? What is the link to your site? |
April 2, 2024 at 7:15 pm #15474908 | |
Mateus Getulio Supporter
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. Thank you, please let us know how that goes. Mateus |
April 3, 2024 at 1:49 pm #15478794 | |
christopheG-16 |
I saw these recommandations in others cases. But it doesn't work like that : |
April 3, 2024 at 6:09 pm #15479972 | |
Mateus Getulio Supporter
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. Privacy and Security Policy We have strict policies regarding privacy and access to your information. Please see: **IMPORTANT** - Please make a backup of site files and database before providing us access. Please, let me know if you need any additional details. Have a nice day. |
April 4, 2024 at 3:46 pm #15484742 | |
Mateus Getulio Supporter
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. |
April 7, 2024 at 2:15 pm #15491663 | |
christopheG-16 |
Thank you very much. But how did you identify this "class-af-a-q-main" file? And how did you modify it with my WPML user (administrator profile)? |
April 8, 2024 at 11:01 am #15493779 | |
Mateus Getulio Supporter
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. Kind regards, Mateus |
April 9, 2024 at 7:58 am #15497266 | |
christopheG-16 |
interesting! But which plugin? (this is my last question) |
April 9, 2024 at 12:54 pm #15499331 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
The plugin printing this text is 'Addify - Advanced Product Quantity', I inferred it based on the string domain name: addify-product-qty. |
April 9, 2024 at 1:01 pm #15499347 | |
christopheG-16 |
My question is "which file manager plugin" (you removed afterwards)? |
April 9, 2024 at 1:05 pm #15499358 | |
Mateus Getulio Supporter
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. Kind regards, |