WordPress.org

Ready to get started?Download WordPress

Forums

WP Store Locator
[resolved] WPML (19 posts)

  1. Richard-B
    Member
    Posted 4 months ago #

    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/

  2. Tijmen Smit
    Member
    Plugin Author

    Posted 4 months ago #

    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.

  3. Richard-B
    Member
    Posted 4 months ago #

    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...

  4. Tijmen Smit
    Member
    Plugin Author

    Posted 4 months ago #

    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?

  5. Richard-B
    Member
    Posted 4 months ago #

    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'] ) )

  6. Tijmen Smit
    Member
    Plugin Author

    Posted 4 months ago #

    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.

  7. Richard-B
    Member
    Posted 4 months ago #

    Many thanks Tijmen!

  8. Tijmen Smit
    Member
    Plugin Author

    Posted 4 months ago #

    Maybe something like this works with WPML (untested)?

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

  9. Richard-B
    Member
    Posted 4 months ago #

    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!!

  10. Tijmen Smit
    Member
    Plugin Author

    Posted 2 months ago #

    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.

  11. Richard-B
    Member
    Posted 2 months ago #

    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! :)

  12. Tijmen Smit
    Member
    Plugin Author

    Posted 2 months ago #

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

  13. Richard-B
    Member
    Posted 2 months ago #

    Thanks :)

  14. techjam
    Member
    Posted 1 month ago #

    Hi Richard,

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

  15. composit
    Member
    Posted 1 month ago #

    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 !

  16. Tijmen Smit
    Member
    Plugin Author

    Posted 1 month ago #

    @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.

  17. composit
    Member
    Posted 1 month ago #

    Thanks for your reply.
    No I can't see Store Locator strings in WPML strings manager.
    What do people who fail to see the strings?

  18. Tijmen Smit
    Member
    Plugin Author

    Posted 1 month ago #

    Not the one you are looking for, or none at all? I haven't heard of none showing up.

    I'm not an expert with WPML, but isn't there an option to re-scan the plugin folder after adding a new plugin?

  19. Richard-B
    Member
    Posted 4 weeks ago #

    Hi Composit

    (make sure you are using the latest version of WP Store Locator)

    - In your dashboard go to WPML > Theme and plugins localization
    - Scroll down to WP Store locator, click the checkbox next to it
    - at the bottom of the plugins list click 'rescan the selected plugins for strings'

    Now when you use the String Translation area you should be able to filter for WPSL and see all the translatable strings from the plugin or search for the one you want to translate.

Reply

You must log in to post.

About this Plugin

About this Topic