Support » Plugin: Google Map for Contact Form 7 » Translating default fields does not work

  • Resolved Vassos Hadjivassiliou

    (@more2think)


    Hello @aurovrata
    I hope you are doing well.
    First of all thank you for this amazing plugin.

    I have an issue with translating the fields. I add the code you provide but nothing changes. The fields are not translated.

    By the way, there are two syntax errors in the code. I don’t read code. Somebody noticed this for me as I got an error when trying to save.
    Syntax error 1: The first field is missing a ; at the end of the first line
    Syntax error 2: The fourth field is missing a ; at the end of the fourth line.

    This is the code I am talking about (For translating the fields)

    add_filter(‘cf7_google_map_address_label’, ‘change_address_label’,10,2)
    function change_address_label($label, $field_name){
    if(‘your-location’==$field_name){
    $label = ‘Adresse’;
    }
    return $label;
    }
    add_filter(‘cf7_google_map_city_label’, ‘change_city_label’,10,2)
    function change_city_label($label, $field_name){
    if(‘your-location’==$field_name){
    $label = ‘Ville’;
    }
    return $label;
    }
    add_filter(‘cf7_google_map_pincode_label’, ‘change_pincode_label’,10,2)
    function change_pincode_label($label, $field_name){
    if(‘your-location’==$field_name){
    $label = ‘Code postal’;
    }
    return $label;
    }
    add_filter(‘cf7_google_map_country_label’, ‘change_country_label’,10,2)
    function change_country_label($label, $field_name){
    if(‘your-location’==$field_name){
    $label = ‘Pays’
    }
    return $label;
    }`

    But regardless of this, it still does not translate the fields. Nothing happens in the front-end.

    Thank you in advance

    Vassos

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    Hi Vassos,

    thank you for reaching out on the forum instead of the repo. This way others can more easily find your question and my answers 🙂

    add_filter(‘cf7_google_map_address_label’, ‘change_address_label’,10,2)
    function change_address_label($label, $field_name){
    if(‘your-location’==$field_name){
    $label = ‘Adresse’;
    }
    return $label;
    }

    what is the field name you are using in your form?

    Thread Starter Vassos Hadjivassiliou

    (@more2think)

    I use the default fields that come with the plugin.
    I just want to translate the default labels in Greek

    e.g

    add_filter(‘cf7_google_map_address_label’, ‘change_address_label’,10,2);
    function change_address_label($label, $field_name){
    if(‘your-location’==$field_name){
    $label = ‘Διεύθυνση’; 
    }
    return $label;
    }
    Plugin Author Aurovrata Venet

    (@aurovrata)

    i tested this on my server and it works when you use the right field name. So either you have an error in your field-name or the formatting of your PHP….did you run in WP_DEBUG mode to see if your function is being called?

    Thread Starter Vassos Hadjivassiliou

    (@more2think)

    Oh my God you are right. I had an error in my field name and the name of the map. It works.
    Sorry for the trouble and thank you again for this plugin.

    Have a nice day

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Oh my God you are right.

    🙂 silly mistakes happens all the time when coding!

    Sorry for the trouble and thank you again for this plugin.

    you’re wc. Kindly leave a review when you have a moment to spare

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