Get the correct locale during ajax refreshes

<?php

/**
 * Add to your (child) theme's functions.php
 * Requires https://facetwp.com/add-ons/multilingual/
 */
function fwp_get_locale() {
    if ( function_exists( 'FWP' ) && ! empty( $_POST['data']['http_params']['lang'] ) ) {
        return $_POST['data']['http_params']['lang'];
    }
    return get_locale();
}