You can use a filter to modify the value before it is set
function __language_attributes($lang){
// ignore the supplied argument
$langs = array( 'en-US', 'KO', 'JA' );
// change to whatever you want
$my_language = $langs[0];
// return the new attribute
return 'lang="'.$my_language.'"';
}
add_filter('language_attributes', '__language_attributes');
Then just make sure your theme header has the correct php function
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<head>
Another approach would be to set the language in a global variable before the filter is called.
// Make this variable global
global $__language_attribute;
// Set the language we want to use
$__language_attribute="en-US";
// Listen for the language filter
add_filter('language_attributes', '__language_attributes_use_global');
function __language_attributes_use_global($lang){
global $__language_attribute;
return "lang=\"$__language_attribute\"";
}
ALTERNATE
// set your language here
$my_lang = 'KO';
// subscribe with closure to apply this value later
add_filter('language_attributes', function($lang) use ($my_lang) {
return 'lang="' . $my_lang . '"';
});