Skip to content Skip to sidebar

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

Problem:
Client is facing issues with 'Book Training' and footer content not appearing in String Translations, and the footer translation not updating on the Swedish website.

Solution:
We replicated the issue and resolved it by taking the following steps:
1. Edit the file functions.php in the theme folder.
2. Around line 59, replace the function mfn_global() with this one:

function mfn_global() {
    global $mfn_global;
    $header_global = mfn_template_part_ID('header');
    $header_global = apply_filters('wpml_translate_single_string', $header_global, 'admin_texts_mfn_header_entire_site', 'mfn_header_entire_site' );
 
    $footer_global = mfn_template_part_ID('footer');
    $footer_global = apply_filters('wpml_translate_single_string', $footer_global, 'admin_texts_mfn_footer_entire_site', 'mfn_footer_entire_site' );
  
    $mfn_global = array(
        'header' => $header_global,
        'footer' => $footer_global,
        'sidemenu' => mfn_global_sidemenu_id(),
        'single_product' => mfn_single_product_tmpl(),
        'blog' => mfn_archive_template_id('blog'),
        'portfolio' => mfn_archive_template_id('portfolio'),
    );
}

3. Navigate to WPML > String Translation > Translate texts in admin screens. Search for "mfn_header_entire_site" for the header and "mfn_footer_entire_site" for the footer template, then add them to string translation.
4. Go to Templates and translate the Header/Footer template.
5. In String Translation, translate the template ID with the translation ID.

If this solution works for you, please inform the theme author so they can include this fix in their next update.

If this solution doesn't seem relevant to your issue, please open a new support ticket with us.

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 14 replies, has 2 voices.

Last updated by Long Nguyen 1 year, 8 months ago.

Assisted by: Long Nguyen.

Author Posts
December 20, 2023 at 2:18 am #15097125

alexanderG-73

Thanks Long,

Now the only problem remaining is the Book Training and the content of the Footer not showing up in String Translations. For the footer I created a translation but it does not update on the Swedish website.

Any ideas what could be the problem?

December 20, 2023 at 2:40 am #15097203

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

I can replicate the issue on the sandbox site. I fixed the issue by following steps:

1. Edit the file /wp-content/themes/betheme/functions/theme-functions.php

2. Around line 858, replace the code:

if( !empty($default_lang) && !empty($current_lang) && $current_lang != $default_lang ) $lang_postfix = '_'.$current_lang;

with this one:

if( !empty($default_lang) && !empty($current_lang) && $current_lang != $default_lang ) $lang_postfix = '_'.$current_lang;
$lang_postfix = ''; //remove $lang_postfix

3. Go to WPML > String Translation > Translate texts in admin screens > Search for the name "mfn_header_entire_site" for header and "mfn_footer_entire_site" for footer template > Add them to string translation.

4. Go to Templates > Translate the Header/Footer template.

5. Go to String Translation > Translate the template ID with the translation ID.

If it works on your site, please help me report this issue to the theme author to add the fix on their next update.

Thank you.

String Translation ‹ Sandbox — WordPress 2023-12-20 09-34-43.png
Edit Template “Default header SV” ‹ Sandbox — WordPress 2023-12-20 09-34-22.png
December 20, 2023 at 7:32 pm #15105715

alexanderG-73

I followed all the steps and it doesn't work.

December 21, 2023 at 3:59 am #15106471

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

The theme version on your site is 27.2.12 while on the sandbox site, it is an older version 27.2.9.4. So the workaround above might not work.

Please try this workaround and let me know how it goes:

1. Edit the file functions.php in the theme folder.

2. Around line 59, replace the function mfn_global():

function mfn_global() {
    global $mfn_global;
    $mfn_global = array(
    	'header' => mfn_template_part_ID('header'),
    	'footer' => mfn_template_part_ID('footer'),
		'sidemenu' => mfn_global_sidemenu_id(),
    	'single_product' => mfn_single_product_tmpl(),
    	'blog' => mfn_archive_template_id('blog'),
    	'portfolio' => mfn_archive_template_id('portfolio'),
    );
}

with this one:

function mfn_global() {
    global $mfn_global;
    $header_global = mfn_template_part_ID('header');
    $header_global = apply_filters('wpml_translate_single_string', $header_global, 'admin_texts_mfn_header_entire_site', 'mfn_header_entire_site' );

    $footer_global = mfn_template_part_ID('footer');
    $footer_global = apply_filters('wpml_translate_single_string', $footer_global, 'admin_texts_mfn_footer_entire_site', 'mfn_footer_entire_site' );
 
    $mfn_global = array(
    	'header' => $header_global,
    	'footer' => $footer_global,
		'sidemenu' => mfn_global_sidemenu_id(),
    	'single_product' => mfn_single_product_tmpl(),
    	'blog' => mfn_archive_template_id('blog'),
    	'portfolio' => mfn_archive_template_id('portfolio'),
    );
}

❌ IMPORTANT: Please backup your database and website before proceeding ❌

Refer documentation https://wpml.org/wpml-hook/wpml_translate_single_string/

Look forward to your reply.
Thanks

December 21, 2023 at 9:08 am #15107809

alexanderG-73

Unfortunately it did not resolve the issue. It gave me a 500 Internal Server Error. Had to roll back the website with backup.

December 21, 2023 at 9:35 am #15108131

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

Strange, it works on my local site and sandbox site also. You can check the code here
hidden link

Please share a screenshot or the code after you apply the workaround. Or you can share your site credentials (wp-admin and FTP), I will help you to apply the code. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌

Look forward to your reply.
Thanks

Edit Themes ‹ Sandbox — WordPress 2023-12-21 16-33-53.png
December 21, 2023 at 10:28 am #15108861

alexanderG-73

Not sure what happened, I tried again and now it worked.

December 21, 2023 at 10:47 am #15109005

alexanderG-73

I have to re-open this ticket again. The translations came through but now the design does not follow with the translations.

Screenshot 2023-12-21 at 11.45.19.png
December 22, 2023 at 2:34 am #15113687

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

It might be a caching/temporary issue. Please try to clear all caches and recheck this issue. Now I see the translation homepage displayed as well.

Thanks.

Få din drömkropp på 20 minuter med EMS-träning i Malmö – Bodysync Hub 2023-12-22 09-31-57.png
December 22, 2023 at 6:37 pm #15121579

alexanderG-73

I did cache reset and it didn't help, then I went to the Swedish translation of the template and updated the whole post, cleared the cache again and the result is better (the same you provided in the screenshot) but it still is not the same as the original, some styles are missing in both the header and the footer.

December 25, 2023 at 2:52 am #15125277

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

Can you please recheck the style of elements in the header and footer again? Please check the screenshot attached.
I go to the admin area > Switch to the Swedish language > Edit the translation template and set the style for elements manually as you do in English.

Look forward to your reply.
Thanks

Get Your Dream Body in 20 Minutes with EMS Training in Malmö – Bodysync Hub 2023-12-25 09-43-49.png
Få din drömkropp på 20 minuter med EMS-träning i Malmö – Bodysync Hub 2023-12-25 09-46-40.png
December 25, 2023 at 2:22 pm #15126769

alexanderG-73

Hi,

Not sure what you mean entirely, I went to the Templates for Swedish language and all the styles in the builder were correct, but they still don't appear right on the website. You seem to have managed to get the right, result. Did you do anything else?

December 26, 2023 at 1:29 am #15127731

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

On my end, the style of the header and footer in Swedish is correct, as you see in the screenshots above. It could be a caching issue on your end. Please try to clear all caches (browser, plugin, CDN ...) and recheck the style.

Look forward to your reply.
Thanks

December 26, 2023 at 2:22 pm #15130365

alexanderG-73

I tried all of the above, clearing cache multiple times (CDN, Plugins, etc) including on 3 different browsers and same issues persist on my phone and my PC. It only looks correct in Safari on Mac, but Chrome, Brave and Safari on iOS same issue. I have temporarily reverted the string translation of the header and footer IDs since I'm unable to resole it for now.

December 27, 2023 at 3:39 am #15131040

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

I understand why it doesn't work. Please follow the steps I suggested above https://wpml.org/forums/topic/i-created-a-translation-of-header-footer-but-it-does-not-update-on-the-swedish-website/#post-15125277

Edit the template header/footer in Swedish language, set the style as you do with the template in English > Click on Update > Click on Save. These steps will generate a CSS file for the template in the Swedish language, it is located in the folder /wp-content/uploads/betheme/css.

Then you need to go to One.com > Performance > Clear performance and CDN cache. Now you can see it works as well on my end: Chrome browser on desktop and Safari browser on mobile.

Look forward to your reply.
Thanks

Screenshot 2023-12-27 at 10.33.41.png
IMG_3734.PNG
BeBuilder | Default Header (SV) 2023-12-27 10-17-19.png