Modifying an enqueued script URL

You can use the script_loader_src function to filter the URLs of scripts before they are output in a <script> tag. I’d suggest something like this:

add_filter(
    'script_loader_src',
    function( $src, $handle ) {
        // Only filter the specific script we want.
        if ( 'google-recaptcha' === $handle ) {
            // Add the argument to the exisitng URL.
            $src = add_query_arg( 'hl', '<locale>', $src );
        }

        // Return the filtered URL.
        return $src;
    },
    10, // Default priority.
    2 // IMPORTANT. Needs to match the number of accepted arguments.
);

Just replace '<locale>' with whichever locale you need, or a variable containing it.

error code: 523