jsm-user-locale

JSM's User Locale

View the Project on GitHub jsmoriss/jsm-user-locale

JSM's User Locale Selector for the WordPress Toolbar (Perfect for Core / Theme / Plugin Translators)

Plugin NameJSM's User Locale
SummaryAdd a quick and easy user locale / language selector in the WordPress admin back-end and front-end toolbar menus.
Stable Version1.2.2
Requires At LeastWordPress 4.7
Tested Up ToWordPress 4.9.2
Contributorsjsmoriss
LicenseGPLv3
Tags / Keywordsuser, locale, language, select, admin, back-end, front-end, polylang

Description

Add a user locale drop-down menu item in the WordPress admin back-end admin and front-end toolbar menus.

Perfect for translators or anyone who needs to switch languages quickly and easily — allows logged-in users to change their preferred locale / language setting right from the toolbar menu (instead of having to update their WordPress user profile page).

The default WordPress behavior is to apply the user locale preference to the admin back-end only — this plugin extends the user locale / language preference to the front-end webpage as well.

There are no plugin settings — simply install and activate the plugin.

Power-users / Developers

See the plugin Other Notes page for information on available filters.

Do you use the Polylang plugin?

If the Polylang plugin is active, the user locale menu will automatically use the correct Polylang language URLs for the current webpage.

Do you use the WPSSO Core plugin?

If you're using the WPSSO Core plugin, the WPSSO User Locale Selector extension offers the same functionality, with the addition of a settings page — allowing you to modify the menu icon, menu title, and enable/disable the user locale menu on the front-end.

Installation

Automated Install

  1. Go to the wp-admin/ section of your website.
  2. Select the Plugins menu item.
  3. Select the Add New sub-menu item.
  4. In the Search box, enter the plugin name.
  5. Click the Search Plugins button.
  6. Click the Install Now link for the plugin.
  7. Click the Activate Plugin link.

Semi-Automated Install

  1. Download the plugin ZIP file.
  2. Go to the wp-admin/ section of your website.
  3. Select the Plugins menu item.
  4. Select the Add New sub-menu item.
  5. Click on Upload link (just under the Install Plugins page title).
  6. Click the Browse... button.
  7. Navigate your local folders / directories and choose the ZIP file you downloaded previously.
  8. Click on the Install Now button.
  9. Click the Activate Plugin link.

Frequently Asked Questions

Frequently Asked Questions

Other Notes

Other Notes

Additional Documentation

Developer Filters

To exclude the user locale menu item from the front-end toolbar menu, and ignore the user locale / language preference in the front-end webpage, add the following filter hook to your functions.php file:

add_filter( 'jsm_user_locale_front_end', '__return_false' );

To modify the user locale menu title (default is "%s"), you can hook the 'jsm_user_locale_menu_title' filter:

`
add_filter( 'jsm_user_locale_menu_title', 'customize_user_locale_menu_title', 10, 2 );

function customize_user_locale_menu_title( $menu_title, $menu_locale ) {
    return __( 'User Locale (%s)', 'your_text_domain' );
}

`

You can also modify the URL used to reload the page (after selecting a locale from the menu) by hooking the 'jsm_user_locale_redirect_url' filter.

`
add_filter( 'jsm_user_locale_redirect_url', 'customize_user_locale_redirect_url', 10, 2 );

function customize_user_locale_redirect_url( $url, $user_locale ) {
    // modify the redirect url here
    return $url;
}

`