About FreeBSD

Change the WordPress language from en-US to en

Obviously the correct way to change the language of a WordPress blog is to apply a language pack or install the required language variant in the first place.

However, if the only objective is to change the value of the lang attribute of the html element, then this can be accomplished with a simple database patch.

Thelangattribute

The lang attribute of the html element informs the browser as to the language of the article. The value specifies a language code which consists of a primary-code and zero or more subcodes. For example, en is the primary-code representing English, and US and GB are the subcodes for American English and British English respectively.

TheWPLANGoption

WordPress uses the WPLANG option to define the value of the lang attribute. Generally this is defined by the language of the installation or a language pack.

Where the required language is a variant of the primary language English, the use of a language pack may be overkill.

In older versions of WordPress (prior to 4.0), the WPLANG option could be defined in the wp-config.php file, for example:

define(’WPLANG’, ’en’);    // to specify generic English
define(’WPLANG’, ’en_GB’); // to specify British English

In current versions of WordPress, the WPLANG option is defined in the database.

Always ensure that the database is backed up before performing any manual maintenance.

This SQL patch will change the value of the lang attribute to generic English (by removing any subcode):

update wp_options set option_value = ’en’ where option_name = ’WPLANG’;
In WordPress version 4.1, the dashboard indicates that the translations require updating, even if no language packs are installed. Creating an empty directory called languages under the wp-content directory (where language packs normally reside) seems to have suppressed this benign warning.

References