This page redirects to an external site: https://developer.wordpress.org/reference/hooks/locale/
An example of changing the locale language, based on a parameter pass on the url.
<?php
add_filter( 'locale', 'set_my_locale' );
function set_my_locale( $lang ) {
if ( 'gl' == $_GET['language'] ) {
// set to Greenlandic
return 'ka_GL';
} else {
// return original language
return $lang;
}
}
?>