WPML allows you to translate your site’s login and registration pages. This way, users can login or register for your site in their preferred language.
WordPress offers its own language switcher for login and registration pages as of WordPress 5.9. However, this only allows site users to view the login and registration pages in the language they choose. When they log in, they see the site admin area in the default language.
With WPML, you can translate your login and registration pages and seamlessly direct your site users to the admin area in the language they chose.
To do so, you first need to enable the translation of those pages, then translate the pages as normal.
If your site uses nginx, there are some extra considerations, explained below.
Login and registration pages are usually accessed by going to URLs similar to these:
- Registering in a secondary language:
- Logging in:
- Logging in in a secondary language:
To translate these login and registration pages, go to WPML → Settings and scroll to Login and registration pages. Check the box to allow translations.
Please note: If you choose not to enable the translation of login and registration pages, no language switcher will show. If you have WPML enabled, it is not possible to use the default WordPress language switcher on these pages.
WordPress 5.9 includes the translations for these pages as PO files, so the translations will populate automatically. If you want to change a translation, go to WPML → String Translation and search for the text you want to translate. Then click the pencil icon to adjust the translation.
You can see the translated login or registration page and the WPML language switcher on the site’s front-end.
You can also use String Translation to translate registration email and forgotten password emails.
If your site uses nginx and your language URL format is set to Different languages in directories, you may see a 404 error when trying to access a login or registration page in a secondary language.
To avoid this, you will need to adjust some settings.
Rules for translating the login and registration pages are usually stored in the htaccess file. Because ngnix does not access this file, you will need to modify the nginx settings to add the following rewrite rules. If you do not have the permissions to do so, please contact your hosting provider to make these changes.
The rule to add is:
rewrite ^/xx/wp-login.php /wp-login.php break;
Where xx is the language code.
For example, if the user has English, German, and French languages active on their site, the nginx rules would be:
rewrite ^/en/wp-login.php /wp-login.php break; rewrite ^/de/wp-login.php /wp-login.php break; rewrite ^/fr/wp-login.php /wp-login.php break;
If your language URL format is set to A different domain per language or Language name added as a parameter, no additional configurations are required.