Skip Navigation

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

Problem:
In your blog using the Blocksy theme, you are facing an issue where translation labels for links to the profile and log-out are not updating after switching languages, despite being translated in WPML > String Translation.
Solution:
We recommend adding the following XML code to WPML > Settings > Custom XML Configuration to register the dropdown fields for translation:
https://wpml.org/forums/topic/the-button-label-does-not-change-in-the-blog-when-languages-have-been-switched/#post-15839077

If you are using a child theme, adjust the first key name to

<key name="theme_mods_blocksy-child"></key>

. You can find the correct option name from the table wp_options in the database. After adding the code, go to WPML > String Translation and translate the strings there. Check the translation strings in the frontend.
For more details, refer to the documentation on translating strings in the wp_options table.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we 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. If further assistance is needed, please open 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.

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by Long Nguyen 6 months, 3 weeks ago.

Assisted by: Long Nguyen.

Author Posts
June 13, 2024 at 9:22 am

grzegorzK-16

In my blog, I am using the Blocksy theme which is compatible with WPML.
I have a problem with translation labels for links to the profile and log-out. (The attached screenshot should clarify the issue.)

After entering "Log Out" label in the Blocksy (WordPress) dashboard I found it in WPML > String translation. After translating "Log Out" into Polish "Wyloguj się", the label does not change in the blog when languages have been switched.

(Similarly, I should have the "Profile" label translated.)

June 13, 2024 at 9:54 am
June 13, 2024 at 10:34 am #15735588

grzegorzK-16

Hi!
On sandbox it works properly. Please refere to the screenshot...
regards,
Grzegorz

work ok.jpg
June 14, 2024 at 2:13 am #15738045

Long Nguyen
Supporter

Languages: English (English )

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

Hi,

It could be affected by a third party plugin or a block of code from the child theme that you are using. I suggest you enable a minimal environment as below and recheck this issue:
- Deactivate all plugins except WPML plugins and Blocksy Companion.
- Switch to the main theme Blocksy.
❌ IMPORTANT: Please backup your database and website before proceeding ❌

Looking forward to your reply.
Thanks

June 17, 2024 at 10:05 am #15744556

grzegorzK-16

Hi!

Just in case, I also sent a description of this problem to Blocksy support.

I have done a lot of investigations. In my opinion, the issue is not caused by the Blocksy Companion plugin or Blocksy Child theme.

First of all other strings from Child Theme are translated without any problem. For example: "Profile & Log Out" <> "Profil & Wyloguj się".

Secondly, in Sandbox you gave me I have installed Blocksy Starter Site with Child Theme and everything is OK.

In addition, I have done procedures I found on your support forum. I mean procedures with "Look for strings while pages are rendered" enabled. But it did not help.

I have disabled each plugin to check if there is any conflict with WPML or Blocksy. No success.

Please help me as I have no idea what to do.

regards,
Grzegorz

June 18, 2024 at 1:20 am #15746983

Long Nguyen
Supporter

Languages: English (English )

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

Hi,

The file functions.php in the child theme on your site has a lot of custom code that modifies some WPML features, not the same as the file on the sandbox site.

I also create a backup file and restore your site on my local host to check the issue. The translation string displayed correctly after switching to the main theme Blocksy, here is the screen record hidden link

Looking forward to your reply.
Thanks

June 18, 2024 at 8:19 am #15747787

grzegorzK-16

Hi!

Yes, I know, after switching to the main Blocky theme everything is ok.

In addition, I have tested the impact of the functions.php file in Child theme.
The functions.php file does not cause this issue:

I cleaned up the functions.php file and left only the necessary code:

<?php
if (! defined('WP_DEBUG')) {
die( 'Direct access forbidden.' );
}

add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style('blocksy-child-style', get_stylesheet_uri());
});

You can see that it only affected the language switcher in the main menu. However, I changed the language using the language switcher in the footer. You can see that the phrase "Log out" is still not translated correctly.

The cause of the problem is somewhere else.
See the attached screenshot.

regards,
Grzegorz

funcionsphp cleared.jpg
June 19, 2024 at 3:22 am #15751902

Long Nguyen
Supporter

Languages: English (English )

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

Hi,

I'm not sure what's wrong with your child theme. On my local site, I use the plugin https://wordpress.org/plugins/child-theme-configurator/ to create a new standard child theme and re-create the header button.
Then translate the strings in WPML > String Translation, the translation strings are displayed correctly in the frontend.

Can you try to create a new child theme and recheck the issue?

June 20, 2024 at 12:36 pm #15763627

grzegorzK-16

Hi!
I did what you suggested.

I translated the "Log out" string but still had a problem translating the "Profile" string in the same dropdown.

I found it in WPML > String translation, but it did not work in the front end.

After all, I deleted additional Child themes because restoring base one caused other styling problems.

Could you try to translate the "Profile" string on your sandbox, please? Maybe you can have success 🙂

(I'm still waiting for a response from Blocksy support in this case.)

regards,
Grzegorz

June 21, 2024 at 2:27 am #15769328

Long Nguyen
Supporter

Languages: English (English )

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

Hi,

I can see that issue on the sandbox site. I'm discussing the issue with our 2nd tier support and update you here when I have something to share.

Thanks for your patience.

June 21, 2024 at 7:00 am #15771703

grzegorzK-16

Thank you very much, I'm waiting for the information 🙂

June 25, 2024 at 3:50 pm #15822807

grzegorzK-16

Hi!
Do you have any info for me? Blocksy Support claims they saw a similar issue once. And it was on the WPML side. But they do not remember exactly what it was.
Grzegorz

June 26, 2024 at 2:11 am #15827590

Long Nguyen
Supporter

Languages: English (English )

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

Hi,

Our 2nd tier support is still investigating the issue. I will let you know once I have any information.

Thanks.

June 26, 2024 at 7:43 am #15830813

grzegorzK-16

I see. So I'm looking forward to the solution.
Thank you!
Grzegorz

June 27, 2024 at 2:53 am #15839077

Long Nguyen
Supporter

Languages: English (English )

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

Hi,

I got a workaround from the 2nd tier support to register the dropdown fields to translate and show the translation in the frontend.

Please add the XML code below to WPML > Settings > Custom XML Configuration:

<wpml-config>
  <admin-texts>
    <key name="theme_mods_blocksy">
      <key name="header_placements">
        <key name="sections">
          <key name="0">
            <key name="items">
              <key name="1">
                <key name="values">
                  <key name="dropdown_items">
                    <key name="*">
                      <key name="label" />
                    </key>
                  </key>
                </key>
              </key>
            </key>
          </key>
        </key>
      </key>
    </key>
  </admin-texts>
</wpml-config>

if you use the child theme, you will need to adjust the first key name to

<key name="theme_mods_blocksy-child">

you can find the correct option name from the table wp_options in the database.

Then go to WPML > String Translation > Translate strings there and check the translation strings in the frontend.

Refer documentation https://wpml.org/documentation/support/language-configuration-files/translate-strings-in-wp-options-table/

Looking forward to your reply.
Thanks