New home › Forums › Pro Add-on › Troubleshooting › Translate Search area on Polylang site
Tagged: search button, translate
- This topic has 5 replies, 2 voices, and was last updated 8 months ago by Matthew.
-
AuthorPosts
-
January 19, 2023 at 11:20 am #76069katgeisParticipant
We have a Polylang site with English and French enabled.
Can you help with either strings or custom jquery to translate “Enter a Location” and “Search” on the map page?
https://pacificmarine.wpengine.com/fr/trouver-un-courtier/
It’s English equivalent is https://pacificmarine.wpengine.com/boat-owner/find-a-broker/Thank you!
Attachments:
You must be logged in to view attached files.January 19, 2023 at 11:26 am #76074MatthewModeratorHi there,
Thank you for getting in touch with us, we do appreciate your time.
Yes sure, you may use the below custom JS code to achieve this:
jQuery(function(){ $(document).ready(function(){ let langType = $('html').attr('lang'); if(langType == 'fr-CA'){ $('.wpgmza-modern-store-locator input.wpgmza-address').attr('placeholder', 'Enter a location...'); $('.wpgmza-modern-store-locator input.wpgmza-search').attr('value', 'Search...'); $('.wpgmza-modern-store-locator input.wpgmza-reset').attr('value', 'Reset...'); } }) })
Please may you copy, paste and save the above code into the “Custom JS” setting block (Maps -> Settings -> Advanced Settings)?
Once this has been done, please may you clear your browser cache and confirm if this helps?
I look forward to hearing back from you.
Kindest Regards,
MatthewJanuary 23, 2023 at 9:40 pm #76104katgeisParticipantThis reply has been marked as private.January 24, 2023 at 11:43 am #76122MatthewModeratorHi there,
Thank you for your response and time on this, I really appreciate it!
I have taken a look at your code and it appears that the code is not executing correctly, thus please may you replace all your code in the “Custom JS” setting block (Maps -> Settings -> Advanced Settings) with the below code:
jQuery(function($){ $(document).ready(function(){ setTimeout(function(){ let langType = $('html').attr('lang'); if(langType == 'fr-CA'){ $('.wpgmza-modern-store-locator input.wpgmza-address').attr('placeholder', 'Saisir un emplacement...'); $('.wpgmza-modern-store-locator input.wpgmza-search').attr('value', 'Recherche...'); $('.wpgmza-modern-store-locator input.wpgmza-reset').attr('value', 'Réinitialiser...'); } }, 1000); }) $(document).on('markerlistingupdated.wpgmza', function(){ $('.wpgmaps_mlist_row .wpgmza-desc').each(function(){ var row = $(this); row.find('p').each(function(){ var p = $(this); console.log($(p).html().trim()); if($(p).html().trim() == ''){ $(p).remove(); } }); }); }); })
Once this has been done, please do let me know if this helps?
Kindest Regards,
MatthewJanuary 26, 2023 at 6:33 pm #76162katgeisParticipantThat worked perfectly. Thank you so much Matthew!
January 27, 2023 at 4:01 pm #76174MatthewModeratorHi there,
Thank you for getting back to me and most valued time, I tremendously appreciate it!
I am most happy to hear that, and it was my great pleasure assisting you with this.
Please may you kindly consider reviewing our plugin at https://wordpress.org/support/plugin/wp-google-maps/reviews/#new-post?
It would really mean the world to me! And if possible, please could I kindly ask you to mention both your name and mine in the review for administrative purposes as this would be a tremendous help?
Should you ever require any further assistance, I am more than happy to help.
Have a fantastic day further!
Kindest Regards,
Matthew -
AuthorPosts
- You must be logged in to reply to this topic.