Support » Plugin: Flexible Map » localize language of directions text ?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author webaware

    (@webaware)

    G’day Wong,

    That’s a function of Google Maps and depends on your browser’s language settings. If you set your browser to preference, say, French above English, Google Maps will show you maps and directions in French.

    cheers,
    Ross

    Hi Ross,

    I think it doesn’t so. I have try another plugin, like Google Routeplanner, and it has a function to change the language of route output. However, for other functions, I prefer Wp Flexible Map plugin.

    Regards,

    Wong

    Plugin Author webaware

    (@webaware)

    G’day Wong,

    If I set Firefox or Google Chrome to have, say, French at the top of my list of accepted languages, I get directions in French. What browser are you using?

    If you want to force the language used by Google Maps, irrespective of what the browser is set for, you can do it with a filter (add it to a simple plugin, or your theme’s functions.php file):

    // force Google Maps to use French
    add_filter('flexmap_google_maps_api_args', function($args) {
    
        $args['language'] = 'fr';
        return $args;
    
    });

    NB: code above is for PHP 5.3+

    cheers,
    Ross

    Hi Ross,

    Yes, I need to localize Google Maps language, irrespective of what the browser is set for. I try the code, but got an error syntax. If the function can be added as parameters for the plugin, I am very pleased.

    Regards,

    Wong

    Plugin Author webaware

    (@webaware)

    G’day Wong,

    I’ll be revisiting the whole approach to localisation in a future version so I’ll address that then.

    In the meantime, here’s a version of the snippet above that should work on PHP 5.2; if you host is using anything older than that, well… move!

    // force Google Maps to use French
    add_filter('flexmap_google_maps_api_args', 'force_flexmap_directions_lang');
    
    function force_flexmap_directions_lang($args) {
        $args['language'] = 'fr';
        return $args;
    }

    cheers,
    Ross

    Hi Ross,

    Yes, it works now! Thank you very much. Your support is excellent.. !

    Best Regards

    Wong

    Plugin Author webaware

    (@webaware)

    G’day Wong,

    NB: I missed the single quotes around the function name in the filter above; please add them to your copy.

    add_filter('flexmap_google_maps_api_args', 'force_flexmap_directions_lang');

    cheers,
    Ross

    thank you Ross!
    this is exactly what i needed.
    i join to wongkasep, your support is excellent!
    i’ll give your plugin 5 stars….:))
    uri

    Plugin Author webaware

    (@webaware)

    Many thanks to both of you, it’s nice to hear that 🙂

    cheers,
    Ross

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘localize language of directions text ?’ is closed to new replies.