I18n

While SleekPixel doesn't currently support internationalization directly through the UI, you can use the sleekPixel/data/custom filter to add translated content from WPML or other translation plugins.

Example: Adding WPML Translated Post Titles

Here's how you can add translated post titles from WPML to be available in your templates:

functions.php

            add_filter(
      "sleekPixel/data/custom", function ($data, $args) {
        $postId = $args["postId"];

        // Get current language
        $currentLang = apply_filters('wpml_current_language', null);

        // Get post title in current language
        $translatedTitle = apply_filters('wpml_translate_single_string', 
          get_the_title($postId), 
          'post_title', 
          'post_' . $postId . '_title',
          $currentLang
        );

        // Add translated title to data array
        $data[] = [
          "value" => "translatedTitle",
          "label" => "Translated Title",
          "data" => $translatedTitle,
        ];

        return $data;
      }, 10, 2 );

      
Copy

This example will add the translated post title for the current language in WPML.