WordPress multi-language site (As SSO Provider) with use locale Discourse instances

Yes, that is the correct filter. For updating the locale of users who already exist on your system, you also need to pass the locale_force_update parameter. This code example will update a user’s locale to ‘fr’:

add_filter( 'wpdc_sso_params', 'wpdc_custom_sso_params' );
function wpdc_custom_sso_params( $params) {
    $params['locale_force_update'] = 'true';
	$params['locale'] = 'fr';

	return $params;
}

The WordPress get_locale() function is going to be unreliable to use for this. On my site that function returns "en_CA". Discourse doesn’t accept this as a valid locale. It wants the string "en".

Here’s the full list of locales that Discourse will accept:

ar, bg, bs_BA, ca, cs, da, de, el, en, es, et, fa_IR, fi, fr, gl, he, hu, id, it, ja, ko, lt, lv, nb_NO, nl, pl_PL, pt, pt_BR, ro, ru, sk, sl, sq, sr, sv, sw, te, th, tr_TR, uk, ur, vi, zh_CN, zh_TW

I think what you want is a URL in this form:

<a href="https://forum.example.com/session/sso?return_path=https://forum.example.com/your-discourse-endpoint">Link Text</a>

The user will be taken to the URL set in the return_path parameter. Let me know if that isn’t what you are looking for.