How to pass a variable into an add_filter() function?

I have this code here:

$  pageLanguage = strtolower($  pageMetadata["language"]);   $  languageArray = array ("afrikaans" => "af", "dutch" => "nl", "french" => "fr", "german" => "de", "spanish" => "es");   $  updatedLanguage = $  languageArray[$  pageLanguage];  add_filter('locale', 'change_my_locale'); function change_my_locale( $  locale ) {   $  locale = $  updatedLanguage;   return $  locale; } 

I would like to know how to pass the variable $ updatedLanguage into the change_my_locale() function please?