Hello Friends, today we will learn about How to change Site language in WordPress. Let me first tell you guys why we wrote this article today. A few days ago, one of my subscribers asked me that he is having a problem in the approval of Google Adsense on his website.
He migrated the site content from Deutsch to English(US). The content was changed to English but he didn’t change site language configuration from WordPress admin, that’s why Google Adsense didn’t accept his application.
Check the screenshot below to understand it better.
So, Let’s start to learn How to change Site languages in WordPress.
1. Check Availability
First of all, we need to know where to change language settings. It is a WordPress function which you will find in Header.php file in activated theme folder:
<html <?php language_attributes(); ?>>
No need to make any change in this code. We have to first check the available languages in your WordPress settings page. Go to, Dashboard >> Settings >> General. If the language you want to change is available on the list, then just select the language and click the update button at the bottom of the settings page.
Once you update your preferred language from the setting page, site language will update automatically in HTML tag. It’ll look like this if you selected English(United States) :
2. If your language is not available
If your preferred language is not available in the list, then you have to add WordPress function in the wp-config.php file.
define('WPLANG', 'de_CH');
You have to just copy the code and paste it in the wp-config.php file. But remember to change the language code from ‘de_CH’ to your preferred language. Here you can find WordPress language codes. In below box, You will see that we appended that code in the wp-config.php file. After adding code just update the file.
define('WPLANG', 'de_CH'); /** The name of the database for WordPress */ define( 'DB_NAME', 'DB-NAME' );/** MySQL database username */ define( 'DB_USER', 'DB-USER' );/** MySQL database password */ define('DB_PASSWORD', 'DB-PASS');/** MySQL hostname */ define( 'DB_HOST', 'localhost' );/** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' );/** The Database Collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' ); /* Authentication Unique Keys and Salts. */ define('AUTH_KEY', 'Your Unique Keys and Salts'); define('SECURE_AUTH_KEY', 'Your Unique Keys and Salts'); define('LOGGED_IN_KEY', 'Your Unique Keys and Salts'); define('NONCE_KEY', 'Your Unique Keys and Salts'); define('AUTH_SALT', 'Your Unique Keys and Salts'); define('SECURE_AUTH_SALT', 'Your Unique Keys and Salts'); define('LOGGED_IN_SALT', 'Your Unique Keys and Salts'); define('NONCE_SALT', 'Your Unique Keys and Salts'); /* WordPress Database Table prefix.*/ $table_prefix = 'wp_'; if ( ! defined( 'ABSPATH' ) ) define( 'ABSPATH', dirname( __FILE__ ) . '/' ); /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php';
After updating wp-config.php file, Let’s go to the Settings >> General page and check whether your language is listed in Site language drop down or not.
Select your language from the Site Languages list and update the General setting page. After updating, refresh(ctrl+F5) your website and check the source code(ctrl+U), it’ll look like this :
So at the end of the article, we learnt how to change site languages in WordPress and also learnt how to fix unsupported language problem in Google Adsense approval process.
4 thoughts on “How to change Site language in WordPress”
Hi my loved one! I wish to say that this post is awesome, nice written and include
almost all vital infos. I would like to see extra posts
like this .
Thanks, sure. please let me know what type of info you need
Hello there! Quick question that’s completely off topic.
Do you know how to make your site mobile friendly?
My weblog looks weird when browsing from my iphone 4.
I’m trying to find a theme or plugin that might be
able to correct this problem. If you have any suggestions, please share.
Thank you!
Hi, can you please share your website URL, so I can check it and suggest you.