[Resolved] Translate Jet Engine Post Types and listings
This thread is resolved. Here is a description of the problem and solution.
Problem: You are trying to display the translated single template of a Jet Engine custom post type using the JupiterX theme, but it keeps showing in the original language.
Solution: 1. Backup your site. 2. To translate template strings like BEDS, BATHS, etc., add the following code to your theme's functions.php file:
3. Save the changes and refresh a product page to see the translation. 4. To make the 'features' post meta translatable, add this code to your theme's functions.php or as a Must Use Plugin:
/**
* Translate associative KEYS for JetEngine 'features' post meta via WPML.
* Place in wp-content/mu-plugins/jetengine-features-wpml.php (recommended) or your theme's functions.php.
*/
add_filter( 'jet-engine/listing/data/get-post-meta', 'myproject_translate_features_keys_wpml', 10, 3 );
/**
* @param mixed $value The meta value resolved by JetEngine (array for 'features').
* @param string $key Meta key (we only act on 'features').
* @param int $object_id Post ID.
*
* @return mixed
*/
function myproject_translate_features_keys_wpml( $value, $key, $object_id ) {
// Only handle the 'features' field and only if it's an associative array like ['Pet-Friendly' => 'true', ...].
if ( $key !== 'features' || ! is_array( $value ) ) {
return $value;
}
// Determine current language (WPML). If WPML is missing, calls below no-op and return originals.
$lang = apply_filters( 'wpml_current_language', null );
if ( empty( $lang ) && defined( 'ICL_LANGUAGE_CODE' ) ) {
$lang = ICL_LANGUAGE_CODE;
}
$context = 'Jet Engine Admin Labels';
// Small request-level cache to avoid re-translating the same labels repeatedly.
static $cache = [];
$translated = [];
foreach ( $value as $label => $flag ) {
$label_str = (string) $label;
$name = md5( $label_str ); // stable key as you requested
$ck = $context . '|' . $name . '|' . (string) $lang;
if ( isset( $cache[ $ck ] ) ) {
$new_label = $cache[ $ck ];
} else {
// Register (idempotent) so translators can provide translations in WPML String Translation.
do_action( 'wpml_register_single_string', $context, $name, $label_str );
// Translate. If WPML inactive or no translation yet, this returns the original.
$new_label = apply_filters( 'wpml_translate_single_string', $label_str, $context, $name, $lang );
if ( ! is_string( $new_label ) || $new_label === '' ) {
$new_label = $label_str;
}
$cache[ $ck ] = $new_label;
}
// Keep the same value ('true'/'false') as stored; do NOT coerce unless you want to.
$translated[ $new_label ] = $flag;
}
return $translated;
}
5. Save the changes. 6. Go to WPML -> Strings Translation and translate the strings under the 'Jet Engine Admin Labels' domain.
If this solution does not resolve your issue or seems outdated, please check for related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we recommend opening a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
I updated the JupiterX and the plugins but the problem remains.Regarding the Post Content Widget, I don't understand what exactly you mean because I haven't seen any related message.
Please try to find a solution the soonest possible. We are under huge pressure, as we talked with the client yesterday.
I'm still waiting for a feedback and a solution. Days are passing and we can't deliver the project because of this issue.
It can't be something that you cannot solve. Please look into the problem and give us a solution. We don't have any more time to waste! The client needs the website.
We are under huge pressure and we will have problems with the client if the delay continues.
I've just sent a message to our second-tier supporters asking them to check this issue.
If you'd like, we can also take another path in investigating this issue by trying to replicate it on a fresh WordPress installation. This way we can check if what you are experiencing is a new problem with WPML and JetEngine that has not yet been reported to us, vs a specific problem on your site.
If you'd like to proceed down this path, then we need to replicate this issue on a fresh WordPress installation. Then I'll be able to escalate it to our compatibility team. For this, I created a test website with a clean WordPress install. You can access it through this link:
hidden link
With this link, you'll be directly logged in.
Could you please install the JetEngine plugin and see if the issue is replicable on a clean WordPress installation?
I've configured WPML to have English as the default language and Russian as the second language.
Please also make sure that you are installing the latest version of the plugin.
When everything is finished and you can replicate the problem, please let us know.
Important! Do not import your site to the test site. We must replicate the problem on a fresh, clean WordPress installation.
In any case, I'll update you here once I have news from our second-tier supporters.
I can't install the JetEngine plugin because it is bundled with JupiterX theme. Also, I followed the link that you gave me, but I couldn't reach the dashboard.
Anyway, this is getting very serious for us, as we are facing problems with our client. Please give priority to our ticket and try to resolve the issue. We don't have any more time!
Now refresh a product in Russia and see the strings that come from the template, like BEDS, BATHS, FLOOR, and PARKINGS, are translated.
4. To make the strings from Features which are added as post meta show in Strings Translation for translation, add the following code. (It is recommended you add this code as a Must Use Plugin in the /mu-plugins/ folder in the /wp-content/ folder. If the /mu-plugins/ folder does not exist, then add it and call the file jetengine-features-wpml.php. Alternatively, add this function to the functions.php of your theme as you did with the first function.)
/**
* Translate associative KEYS for JetEngine 'features' post meta via WPML.
* Place in wp-content/mu-plugins/jetengine-features-wpml.php (recommended) or your theme's functions.php.
*/
add_filter( 'jet-engine/listing/data/get-post-meta', 'myproject_translate_features_keys_wpml', 10, 3 );
/**
* @param mixed $value The meta value resolved by JetEngine (array for 'features').
* @param string $key Meta key (we only act on 'features').
* @param int $object_id Post ID.
*
* @return mixed
*/
function myproject_translate_features_keys_wpml( $value, $key, $object_id ) {
// Only handle the 'features' field and only if it's an associative array like ['Pet-Friendly' => 'true', ...].
if ( $key !== 'features' || ! is_array( $value ) ) {
return $value;
}
// Determine current language (WPML). If WPML is missing, calls below no-op and return originals.
$lang = apply_filters( 'wpml_current_language', null );
if ( empty( $lang ) && defined( 'ICL_LANGUAGE_CODE' ) ) {
$lang = ICL_LANGUAGE_CODE;
}
$context = 'Jet Engine Admin Labels';
// Small request-level cache to avoid re-translating the same labels repeatedly.
static $cache = [];
$translated = [];
foreach ( $value as $label => $flag ) {
$label_str = (string) $label;
$name = md5( $label_str ); // stable key as you requested
$ck = $context . '|' . $name . '|' . (string) $lang;
if ( isset( $cache[ $ck ] ) ) {
$new_label = $cache[ $ck ];
} else {
// Register (idempotent) so translators can provide translations in WPML String Translation.
do_action( 'wpml_register_single_string', $context, $name, $label_str );
// Translate. If WPML inactive or no translation yet, this returns the original.
$new_label = apply_filters( 'wpml_translate_single_string', $label_str, $context, $name, $lang );
if ( ! is_string( $new_label ) || $new_label === '' ) {
$new_label = $label_str;
}
$cache[ $ck ] = $new_label;
}
// Keep the same value ('true'/'false') as stored; do NOT coerce unless you want to.
$translated[ $new_label ] = $flag;
}
return $translated;
}
5. Save the changes.
6. Go to WPML -> Strings Translation, and filter to show the 'Jet Engine Admin Labels' domain.
7. Translate the strings—for example, Painted, Park, Dog Washing Station, Pet-Friendly.
Now these strings will also show in Russian.
Please let us know how it goes.
Meanwhile, our compatibility team will also check this issue and will likely need to contact the JetEngine developers. We will keep you updated on any news regarding this issue.
If the above workaround fixed the issue on your site, please mark this ticket as resolved.
Otherwise, here are some more findings from our compatibility developer. In his mind, it is not a compatibility issue but a workflow issue. Here is what he explained.
1. Translating "features" labels
I checked, and this is a checkbox meta-field. In this case, the client should follow section 4 of their documentation and use a glossary: hidden link
2. Translating the Elementor template
They’re not using Elementor PRO; the template system and display conditions seem to come from JupiterX. There’s documentation for that as well: hidden link.
From what I can see, the "House Single" template is translated in the backend, but the EN version is still used on the frontend for RU.
3. I checked the display conditions, and the rules for the EN layout are jupiterx-condition-rules:
The documentation clearly advises "Avoid setting up separate conditions for each language." So I strongly think this is a workflow issue rather than a compatibility issue. The fact that the footer is correctly using the translated version (footer_ru) and point #1 above reinforces my opinion.
I hope this information (including my previous reply) will help you to solve this problem on your site.
It seems to be working fine when I used the workaround you specified at your previous reply. Thank you for your support.
The next week we will make full check and I will let you know.
We added a new field on the House JetEngine CPT. The field is a WYSIWYG field.
We put some text on the english version, but when we try to translate, the field doesn't show up for translation.
What should we do? This is a last minute problem and we need help the soonest possible, because we deliver today or tomorrow maximum!
Best Regards,
New threads created by Itamar and linked to this one are listed below:
You have replied to a ticket that has been marked as resolved.
Our support team can easily miss replies on resolved tickets.
By chance, I saw your reply and split this ticket into a new ticket.
Please see the new ticket here: https://wpml.org/forums/topic/split-jetengine-post-types-and-wysiwyg-field-issue/
I'll continue to help you there.