Translate Search area on Polylang site

New home Forums Pro Add-on Troubleshooting Translate Search area on Polylang site

  • This topic has 5 replies, 2 voices, and was last updated 8 months ago by Matthew.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #76069
    katgeis
    Participant

    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.
    #76074
    Matthew
    Moderator

    Hi 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,
    Matthew

    #76104
    katgeis
    Participant
    This reply has been marked as private.
    #76122
    Matthew
    Moderator

    Hi 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,
    Matthew

    #76162
    katgeis
    Participant

    That worked perfectly. Thank you so much Matthew!

    #76174
    Matthew
    Moderator

    Hi 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.