Fix TranslatePress inconsistent translations of facet choices before and after facet filtering

<?php
// FacetWP does NOT officially support TranslatePress. It supports WPML and Polylang, with the Multilingual add-on:
// https://facetwp.com/help-center/using-facetwp-with/multilingual/

// Some users do use TranslatePress successfully with FacetWP.
// However, we get reports of inconsistent translations of facet choices before and after facet filtering.
// These issues are reportedly solved by adding this refresh snippet to the (child) theme's functions.php:

add_action('facetwp_scripts', function () {
  ?>
  <script>
    document.addEventListener('facetwp-refresh', function() {
      if ( !FWP.loaded ) {
        FWP.loaded = true;
        FWP.refresh();
      }
    });
  </script>
  <?php
}, 100);