Multilanguage sites made easy!
User Language Switch is a WordPress plugin was developed having in mind the need to have a multilanguage site and be able to translate all your content. This plugin associates any page, post or custom post type with its translation through custom fields in an easy and friendly way. The available languages are taken from the current theme and the WordPress installation.
Here you will find a step by step guide that will help you have your multilanguage site up and running:
|Step 1:||Download the user language switcher plugin from the wordpress repository|
|Step 2:||Upload the `user-language-switch` folder to the `/wp-content/plugins/` directory|
|Step 3:||Activate the plugin through the ‘Plugins’ menu in WordPress|
a) add the shortcode:
b) add the following php code to the template or theme file where you want the language links to appear:
<?php echo uls_language_link_switch(); ?>
In order to localize your menus, firstly you should create a menu for every front-end language using the WordPress backend. You can access this option in Appearance > Menus.
Once you have the menus ready, open the template files where the menus are displayed (normally, these are header.php and footer.php). Locate the part of the code where the menu is rendered and replace it with the php code below, where the attribute ‘menu’ coresponds with the name given to the menu. In this example, ‘main_es’ is the menu showed when the language is spanish (es_ES) and ‘main’ is the default menu:
wp_nav_menu( array('menu' => 'main_es', 'sort_column' => 'menu_order', 'menu_class' => 'sf-menu', 'fallback_cb' => 'default_menu' ));
wp_nav_menu( array('menu' => 'main', 'sort_column' => 'menu_order', 'menu_class' => 'sf-menu', 'fallback_cb' => 'default_menu' ));
Frequently asked questions:
I only see English among the user language switch options
If the only available option you see in the user language options is English, it is because you don’t have any other language available in your wordpress installation nor in your theme.
Make sure you create a ‘languages’ folder in your theme folder containing the .mo and .po files that correspond to the languages you will use in your blog.