Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are trying to translate listing category labels, but encounter issues where some labels are not translated, and translations disappear when the order of listing categories is changed.
Solution:
We have contacted the Motors theme author and identified the issue in their source code. They are working on a fix that will be included in a future update. Meanwhile, we recommend contacting the theme's support to expedite the resolution.

If this solution becomes outdated or does not apply to your case, we recommend opening a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.

For further assistance, please visit our support forum at https://wpml.org/forums/.

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.

This topic contains 9 replies, has 2 voices.

Last updated by Long Nguyen 4 months ago.

Assisted by: Long Nguyen.

Author Posts
July 29, 2024 at 7:32 am #16014052

sergiyY

Background of the issue:
I am trying to translate listing category labels using all known methods, but I don't have success with it. Link to a page where the issue can be seen: hidden link

Symptoms:
Some labels are translated, some of them are not, even though I do all translations the same over. Moreover, the same label can be translated or not depending on the order it has (the translation may disappear if I change the order of listing categories).

Questions:
Why are some listing category labels not translated even though I use the same method for all?
Why does the translation of a label disappear when I change the order of listing categories?

July 29, 2024 at 8:51 am #16014623

sergiyY

So, I've installed Motor theme and demo. I added 5 test listing categories: name1_en, ..., name5_en. And translated those categories to German (name1_de, ..., name5_de).
As you can see here hidden link in filters, 3 labels are translated and 2 are not.
Also, issue occurs on this page: hidden link
Some screenshots are attached.
Thank you.

Inventory – Sandbox.png
Add a Car – Sandbox.png
July 30, 2024 at 2:28 am #16018364

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I'm discussing this issue with our 2nd tier support and I will update you here when I have something to share.

Thanks.

August 6, 2024 at 12:38 pm #16043987

sergiyY

Hi Long,

Any update about the issue?

August 7, 2024 at 2:32 am #16046008

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I got a workaround for the filter on the page "add-a-car" from our 2nd tier support:

1. Edit the file /wp-content/themes/motors/listings/add_car/step_1.php
2. Around line 131, replace the code

<?php foreach ( $data as $data_key => $data_unit ) : ?>

with this one

<?php foreach ( $data as $data_key => $data_unit ) : ?>
	<?php
	 // WPML Workaround for compsupp-7432
    if ( class_exists('Sitepress') ) {
        $textdomain = 'motors';
        $data_slug = 'Motors - WPML String: ' . $data_unit['slug'];
        $data_single_name = 'Motors - WPML String: ' . $data_unit['single_name'];
        
 
        if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) {
            do_action( 'wpml_register_single_string', $textdomain, $data_slug, $data_unit['slug'] );
            do_action( 'wpml_register_single_string', $textdomain, $data_single_name, $data_unit['single_name'] );
        }   
        // Apply the translation to the string
        $data_unit['slug'] = apply_filters('wpml_translate_single_string', $data_unit['slug'] , $textdomain, $data_slug);
        $data_unit['single_name'] = apply_filters('wpml_translate_single_string', $data_unit['single_name'] , $textdomain, $data_single_name);
    }

3. Visit the page with the issue in the original language, this will register the string.
4. Go to WPML > String Translation page and translate the new string (under motors textdomain).
❌ IMPORTANT: Please backup your database and website before proceeding ❌

For the issue on the "inventory" page, we are still investigating the issue. I will update you here when I have more information.

Thanks.

August 7, 2024 at 10:10 pm #16049979

sergiyY

Hi Long,
Thank you for this solution! I can confirm that it works perfectly for my add-a-car page, and now I have all translations there.
I am looking forward to the inventory page solution.

September 3, 2024 at 9:42 am #16134778

sergiyY

Hello,
Any updates on this issue?

September 4, 2024 at 1:13 am #16138156

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Our compatibility team has contacted the Motors theme author and helped them to identify the issue in their source code. They are working on this issue and said that it will be included in a future update. In the meantime, you can also contact their support and help us push things forward.

Thanks for your co-operation.

September 12, 2024 at 11:33 am #16170506
sergiyY

Hey Long

It seems that the theme authors already fixed the issue - in the latest version, the inventory page translations works fine for me.

The add-a-car translation issue still persists in the theme, however, the workaround solution you offered still works, so for me, it is also resolved.

Unfortunately, there is still one more issue with 'options' translation on the website. So I need your help with it. I have a clean test version with the latest version of WP + theme + WPML (I just installed it yesterday), so, if needed, I can share you access to demonstrate this issue. Or I can install it once again on your side.

Thank you.

New threads created by Long Nguyen and linked to this one are listed below:

https://wpml.org/forums/topic/motors-theme-issue-with-options-translation-on-the-website/

September 13, 2024 at 2:30 am #16173815

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I understand that the main issue of this ticket with the translation category label is resolved. We limit one issue per ticket only, so I will split your new issue with 'options' translation into a new ticket for better handling.

Thanks.