• Resolved ansak11

    (@ansak11)


    You can see that even though the page is in English. Date time and social share is still in French. I do not have a way to change them. check the image for reference

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes, that’s a big problem with this plugin, we can’t use a system translator with it. I have the same questions but no concrete response from the developer.

    @spinoops this is what I did to replace words in the English event pages. It’s not the best solution but it works.

    Add this to your functions.php in child theme.

    function replace_words_on_en_events_pages() {
      $current_url = $_SERVER['REQUEST_URI'];
      if (strpos($current_url, '/en/events/') !== false) { ?>
        <script>
          // Function to replace words on the page
          function replaceWordsOnEnEventsPages() {
            // Define the words and their replacements
            const wordReplacements = {
              "Ajouter au calendrier": "Add to Calendar",
              "Date de l’événement": "Event Date",
              "Heure de l’événement": "Event Time",
    		  "Partager l’événement": "Share",
    		  "Inscrivez-vous": "Register",
    		  "Acheter": "Buy Now"
              // Add more word replacements as needed
            };
    
            // Select the content container where you want to perform the replacements using class
            const contentContainers = document.querySelectorAll(".mep-events-container");
    
            // Loop through each content container and perform the replacements
            contentContainers.forEach((container) => {
              let content = container.innerHTML;
    
              // Loop through the word replacements and perform the replacements
              for (const [searchWord, replacement] of Object.entries(wordReplacements)) {
                const regex = new RegExp(searchWord, "gi"); // "gi" means global and case-insensitive
                content = content.replace(regex, replacement);
              }
    
              // Set the modified content back to the container
              container.innerHTML = content;
            });
          }
    
          // Call the replaceWordsOnEnEventsPages function when the page is loaded
          document.addEventListener("DOMContentLoaded", replaceWordsOnEnEventsPages);
        </script>
      <?php }
    }
    add_action('wp_footer', 'replace_words_on_en_events_pages');
    • This reply was modified 1 year, 4 months ago by kpatelneha23.

    @kaptelneha23 fantastic ! it works like a charm ! Thanks a lot !

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Event manager and polylang does not translate certain elements’ is closed to new replies.