WordPress.org

Support

Support » Plugins and Hacks » [Resolved] WPML

[Resolved] WPML

  • Hi Tijmen

    Currently the plugins front-end is not compatible with WPML, if you alter the /templates/default.php file this is easily solvable by changing the ecs_html entries to esc_html_x like this:

    $output .= '<div><label for="wpsl-search-input">' . esc_html( stripslashes( $this->settings['search_label'] ) ) . '</label></div>' . "\r\n";

    Becomes:

    $output .= '<div><label for="wpsl-search-input">' . esc_html_x( stripslashes( $this->settings['search_label'] ) ) . '</label></div>' . "\r\n";

    Now when you scan plugins in WPML the relevant front-end labels are localisable.

    The only text I cannot get to localise are the addresses themselves and the ‘Get Directions’ text. Is there currently anyway of doing this?

    Thanks for the great plugin! Will be using it again!!

    https://wordpress.org/plugins/wp-store-locator/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Tijmen Smit

    @tijmensmit

    Thanks for the tip, will change it in the next release.

    And the ‘Get Directions’ text can be translated on the settings page -> Labels, the addresses should be translated by Google based on the language you set under settings -> API Settings -> Map language.

    Thanks for getting back to me, for the directions text can it only be in one language? I would need it in English and French…

    Plugin Author Tijmen Smit

    @tijmensmit

    Hmm yeah, it only allows for 1 translation. But you would run into the same problem when setting the map language. I think the only way to fix that is to ( if possible, I never worked with WPML ) detect the language and change the language parameter in the Google Maps url dynamicaly.

    For the label text, I think wrapping the label output in esc_html_x in class-frontend.php on line 210 would make it translatable for WPML?

    Thanks Tijmen, I will try changing the language parameter for the Google Maps url within WPML, great idea.

    For the label I have changed it to the below, however it does not get picked up by WPML, is there anywhere else I could try it?

    esc_html_x( stripslashes( $this->settings['directions_label'] ) )

    Plugin Author Tijmen Smit

    @tijmensmit

    No, that is the only location the labels are send to wp_localize_script. If I have some time later this week I will play around with WPML and see if I can find a way to make it work with the labels.

    Many thanks Tijmen!

    Plugin Author Tijmen Smit

    @tijmensmit

    Maybe something like this works with WPML (untested)?

    esc_html_x( stripslashes( __( $this->settings['directions_label'], wpsl ) ) )

    Nearly! this works, would not have though of it without your hint. I guess this would work for all the labels.

    stripslashes( __( $this->settings['directions_label'], wpsl) )

    Thanks again!!

    Plugin Author Tijmen Smit

    @tijmensmit

    Hi, what is the website you are using the plugin on?

    This stripslashes( __( $this->settings['directions_label'], 'wpsl') ) still works fine with wpml, right? Then I will include it in the next update that I’m working on.

    Hi Tijmen
    Is it possible to contact me privately and I will share the URL with you…

    That code is still working well, including it in the next update would be very much appreciated! 🙂

    Plugin Author Tijmen Smit

    @tijmensmit

    Hi Richard, you can email the url to info at tijmensmit.com 🙂

    Thanks 🙂

    Hi Richard,

    Did you manage to create a version of the plugin that is compatible with wpml? Would you mind sharing it?

    Hi, I have WPML with 3 languages : 1 : French / 2 : English / 3 : Spanish. I have seen that it’s possible to translate labels in the plugin settings, but only to one language. Where could I do to translate in my 3 laguages all the lables ?
    (I don’t find this piece of code :
    $output .= ‘<div><label for=”wpsl-search-input”>’ . esc_html( stripslashes( $this->settings[‘search_label’] ) ) . ‘</label></div>’ . “\r\n”;
    in frontend/templates/default.php

    Thanks for your help !

    Plugin Author Tijmen Smit

    @tijmensmit

    @composit does wpml not pickup the strings to translate in the string manager? It seems to work for some people, but others report problems with it.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Resolved] WPML’ is closed to new replies.