Skip Navigation

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

Problem:
It's impossible to translate the top message from the WPFront Notification Bar plugin.

Solution:
The WPFront Notification Bar plugin is currently incompatible with WPML.

However, if you feel comfortable with code, you can use a workaround. To do this, follow the steps below:

1. Prepare a backup of your website.

2. Log into your FTP account.

3. In the root folder of the WPFront Notification Bar plugin, create a new file and call it wpml-config.xml. Paste the following code in there:

<wpml-config>
    <admin-texts>
        <key name="wpfront-notification-bar-options">
            <key name="message" />
        </key>
    </admin-texts>
</wpml-config>

You should now be able to translate the message on the WPML->String Translation page. If the string is not there, please rescan the plugin for strings on the WPML->Theme and plugins localization page.

4. In the WPFront Notification Bar plugin folder, go to the templates/notification-bar-template.php file and open it for editing.

5. Around line 104, you will have the following code:

<div class="wpfront-message">
    <?php echo $this->get_message_text(); ?>
</div>

Change it to:

<div class="wpfront-message">
<?php
    echo apply_filters( 'wpml_translate_single_string', $this->options->message(), 'admin_texts_wpfront-notification-bar-options', '[wpfront-notification-bar-options]message', apply_filters( 'wpml_current_language', NULL ) );
?>
</div>

Relevant Documentation:
https://wpml.org/documentation/support/language-configuration-files/
https://wpml.org/wpml-hook/wpml_translate_single_string/

11/24/2020 update by Itamar

The suggested solution here still works as of this date. The line to change in the templates/notification-bar-template.php file is not around number 119.

100% of people find this useful.

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 10 replies, has 5 voices.

Last updated by gustavoF-11 5 years, 8 months ago.

Assigned support staff: Joanna.

Author Posts
March 2, 2016 at 9:54 pm #828656

vadimP

I am trying to: translate message in WPFront plugin, which displays message on top of my pages

URL of (my) website where problem appears:

hidden link
I expected to see:

I would like to see different text for each language

Instead, I got:

Just 1 field for text, and no option to translate this text via String Translation

Steps to duplicate the issue:

March 2, 2016 at 10:06 pm #828664

vadimP

There is a post regarding this plugin, maybe that snippet of code will be useful

https://wordpress.org/support/topic/internationalize-the-message-url?replies=18

March 3, 2016 at 8:39 pm #829602

Bruno

Hi Vadim,

This plugin seems to be incompatible with the WPML at the time.

As a workaround, please, click on the WPML > String Translation. At the bottom of the page, click on the "Translate texts in admin screens »". Look for 'wpfront-notification-bar-options' link and select the 'Message' option. At the end of the page, click on the "Apply" button. I will attach a picture for you to see.

Then on the WPML > String Translation, that string will be available for translation.

You can see in our documentation step by step to add a custom string for translation: https://wpml.org/documentation/getting-started-guide/string-translation/. Look at the "Translating strings in the wp_options table".

Following the above steps, I could add, in my test environment, this string for translation.

Please, after following these steps, you could check if it is working properly?

Thank you.

message.png
March 4, 2016 at 12:08 am #829670

vadimP

I did everything as you told, I found wpfront-notification-bar-options, checked the box next to Message, but I wasnt able to find this string in String Translation. Domain wasn't there and searching didn't helped too. Next time I opened "Translate texts in admin screens" the wpfront-notification-bar-options was back to collapsed view, without my checkboxes

March 4, 2016 at 6:47 pm #830491

Bruno

Hi Vadim,

I need to request temporary access (wp-admin and FTP) to your site - preferably to a test site where the problem has been replicated if possible - in order to be of better help.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

*** Please let me know exactly what steps should I follow to see the problem.

*** Note: Please make a full backup of your site.

Privacy and Security when Providing Debug Information for Support: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Thank you.

March 9, 2016 at 1:40 pm #833943

Bruno

Hi Vadim,

I did some tests in my test environment also and unfortunately, at the moment this plugin seems to be incompatible with WPML. I'll report this to our compatibility team.

To ensure that this plugin is made compatible with WPML we need to contact the plugin author and work with him on resolving the issue.

I have forwarded the details to our Themes & Plugins Compatibility Team and they will contact the author. Our Compatibility Team will work with the author of the plugin for this to work properly.

Please note that this process may take a while as it depends on how soon the author will reply to our efforts to contact him.

Thank you.

March 12, 2016 at 1:03 am #836255

vadimP

Can you tell me if there are any known notification bar plugin compatible with WPML?

March 25, 2016 at 9:58 am #845900

Joanna

Hello @vadimp,

I'm Joanna from the Support Team and your ticket was escalated to me.

I want you to know that I have a workaround that will make the WPFront Notification Bar plugin work as expected. To do this, please do the following:

1. Prepare a backup of your website.

2. Log into your FTP account.

3. In the root folder of the WPFront Notification Bar plugin, create a new file and call it wpml-config.xml. Paste the following code in there:

<wpml-config>
    <admin-texts>
        <key name="wpfront-notification-bar-options">
            <key name="message" />
        </key>
    </admin-texts>
</wpml-config>

You should now be able to translate the message on the WPML->String Translation page. If the string is not there, please rescan the plugin for strings on the WPML->Theme and plugins localization page.
You will find more information on language configuration files at https://wpml.org/documentation/support/language-configuration-files/.

4. In the WPFront Notification Bar plugin folder, go to the templates/notification-bar-template.php file and open it for editing.

5. Around line 104, you will have the following code:

<div class="wpfront-message">
    <?php echo $this->get_message_text(); ?>
</div>

Change it to:

<div class="wpfront-message">
<?php
    echo apply_filters( 'wpml_translate_single_string', $this->options->message(), 'admin_texts_wpfront-notification-bar-options', '[wpfront-notification-bar-options]message', apply_filters( 'wpml_current_language', NULL ) );
?>
</div>

You can read more about the hook used here at https://wpml.org/wpml-hook/wpml_translate_single_string/.

We will contact the plugin authors as well to ask him for cooperation in making their plugin fully compatible with WPML.

Please let me know if the workaround works for you.

March 25, 2016 at 2:37 pm #846116

vadimP

Thanks, I installed another plugin, which seems to work, thank you for keeping me updated, I will use this on another site!

September 19, 2017 at 2:35 pm #1376665

giulioB-3

Hey Joanna,

I'm trying to go trough the process that you described, but unfortunately, I'm not succeeding.
After the step 3, I scan wpfront-notification-bar plugin and WMPL finds 119 strings. This is the message:
“Scan successful! WPML found 119 strings. They were added to the string translation table.
The following files were processed:

wp-content/plugins/wpfront-notification-bar/classes/base/class-wpfront-base-menu.php
wp-content/plugins/wpfront-notification-bar/classes/base/class-wpfront-base.php
wp-content/plugins/wpfront-notification-bar/classes/base/class-wpfront-options-base.php
wp-content/plugins/wpfront-notification-bar/classes/base/class-wpfront-static.php
wp-content/plugins/wpfront-notification-bar/classes/class-wpfront-notification-bar-options.php
wp-content/plugins/wpfront-notification-bar/classes/class-wpfront-notification-bar.php
wp-content/plugins/wpfront-notification-bar/templates/notification-bar-template.php
wp-content/plugins/wpfront-notification-bar/templates/options-template.php
wp-content/plugins/wpfront-notification-bar/uninstall.php
wp-content/plugins/wpfront-notification-bar/wpfront-notification-bar.php”
Anyway, these 119 strings are not showed anywhere, therefore I can’t translate them.
Can you help?
Thank you!

February 20, 2021 at 10:30 am #8134411

gustavoF-11

vadimP mentioned here a compatible notification bar plugin for WPML. Could you provide a link to try?