Translations

WP Store Locator fully supports internationalization (i18n) and is compatible with WPML, one of the leading multilingual plugins.

The translation files are located in the /wp-content/plugins/wp-store-locator/languages folder. But if you want to create your own translation files, then it’s recommended to create a wp-store-locator folder inside /wp-content/languages, and save the new translations there.

Translation files placed in /wp-content/languages/wp-store-locator take precedence over translation files in the /wp-content/plugins/wp-store-locator/languages folder.

Download existing translation files

You can check if a community created translation exist on this page.

If this is the case, then click on your language and on the following page click on the ‘Stable (latest release)’ link. Scroll down to the bottom and click on ‘export’ to download the language file.

Move the downloaded file to the /wp-content/languages/wp-store-locator folder on your server. If the language in WordPress itself matches with the downloaded file, then the store locator should show the translations.

Create translation files

There are different tools available that can help you create new translation files. In this example, we will use Poedit, an open source program available for Windows, Mac OS X, and UNIX/Linux.

  1. Install Poedit.
  2. Go to File > New from POT/PO file, and select the wpsl.pot from the /wp-content/plugins/wp-store-locator/languages folder.
  3. Select the language of the translation in the “Translation Language” box. Poedit language
  4. Save the translation in /wp-content/languages/wp-store-locator.
    You do need to follow a specific naming convention for the translations to work. It starts with wpsl- followed by the ISO-639 language code and the ISO-3166 country code. So if you, for example, want to create a German translation, then you need to save the file as wpsl-de_DE.po.
  5. You can start translating by selecting a text string in the top box, adding the translation in the “Translation:” box at the bottom, and saving the changes.Poedit translation
If the translations don’t show up, then make sure to flush the transient cache on the settings page.

WPML multilingual setup

To get started with WPML, you first need to purchase the Multilingual CMS package and install the different modules.

If you need help configuring WPML, then please take a look at the getting started guide.

String translation

Open the WPML -> Theme and plugins localization page, scroll down to the “Strings in the plugins” section, check the WP Store Locator check box, and click “Scan the selected plugins for strings.”

When the scan is complete, open the WPML -> String Translations page and select plugin wp-store-locator or admin_texts_plugin_wp-store-locator from the “All contexts” drop down.

WPML Context Dropdown

Look for the string you want to translate, click on “translations” to open the editor and fill in the different translations.

WPML string translation

When you’re done, make sure to select the Translation is complete checkbox before saving the translations; otherwise, they will not appear in the store locator.

If you want to translate the input values from the labels section on the settings page, then make sure to select admin_texts_plugin_wp-store-locator instead of plugin wp-store-locator.

Translate the store pages

Before you can translate the store pages, you first need to enable the option on the WPML -> Translation management page.

Look for the “Custom post types” section near the bottom of the page, select “Translate,” and save the page.

WPML Cpt

Once you have done that, go to Store Locator -> All Stores, and add the translations for the available languages.

WPML Languages

You can change the available languages on the WPML -> Languages -> Site Languages page.

Make sure the permalink option is enabled for the store pages.

Open the WPML -> Translation management -> Multilingual Content Setup page, look for the Custom posts slug translation section, select the check box and save the page.

WPML Custom post slug

Scroll down to the Custom posts section, select the checkbox below Store Locator and fill in the permalink translations.

WPML Slug Translations

Translate Store Categories

Go to the WPML -> Translation management -> Multilingual Content Setup page and look for the Custom taxonomies section. Select “Translate” after “Store Categories” and save the page.

WPML Custom Taxonomies

Open the WPML -> Taxonomy Translation page and select “Store Categories” from the dropdown list. This will show a table where you can create translations for the different store categories.

Translated store categories only show up in the store locator if they contain a translated store location.