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 3 replies, has 3 voices.
Last updated by Dražen 4 years, 11 months ago.
Assisted by: Dražen.
| Author | Posts |
|---|---|
| November 25, 2020 at 1:06 pm #7525609 | |
|
albaC |
I wanted to translate the plugin WPFront Notification Bar. I have followed the 2 tickets indicated below. I have been able to translate the text of the notification bar; however, the translation of the button and the link are not displaying, they display in the main language (although I translated them in strings screen). https://wpml.org/forums/topic/translation-of-wpfront-notification-bar-plugin/ |
| November 25, 2020 at 2:11 pm #7526069 | |
|
Andrés Supporter
Languages: English (English ) Spanish (Español ) French (Français ) Timezone: Europe/Paris (GMT+01:00) |
Hello there, As we discussed in chat, please try to change the file /templates/notification-bar-template.php, in line 149, from:
<a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php echo $button_text; ?></a>
For:
<a class="wpfront-button" onclick="javascript:wpfront_notification_bar_button_action_script();"><?php
echo apply_filters( 'wpml_translate_single_string', $this->options->button_text(), 'admin_texts_wpfront-notification-bar-options', '[wpfront-notification-bar-options]button_text', apply_filters( 'wpml_current_language', NULL ) );
?></a>
Can you translate the button now? |
| November 26, 2020 at 3:23 pm #7536067 | |
|
albaC |
I have changed this piece of code, but the translations are not displaying. As I told you, I was already able to translate the button and the link after follow the 2020 ticket I sent you. Thanks! |
| November 27, 2020 at 12:54 pm #7543269 | |
|
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, thanks for getting back. I was able to make it work following the adjusted code by Andres and previous ticket. I am providing steps by step guide for future reference: 1) In the WPFront Notification Bar plugin folder, go to the templates/notification-bar-template.php file and open it for editing. 2) Around line 109 replace next code: <div class="wpfront-message">
<?php echo $this->get_message_text(); ?>
</div>
with next
<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>
3) Around line 144 replace next code: <a class="wpfront-button" href="<?php echo $this->options->button_action_url(); ?>" target="<?php echo $this->options->button_action_new_tab() ? '_blank' : '_self'; ?>" <?php echo empty($rel) ? '' : "rel=\"$rel\""; ?>><?php echo $button_text; ?></a> with next <a class="wpfront-button" href="<?php echo apply_filters( 'wpml_translate_single_string', $this->options->button_action_url(), 'admin_texts_wpfront-notification-bar-options', '[wpfront-notification-bar-options]button_action_url', apply_filters( 'wpml_current_language', NULL ) ); ?>" target="<?php echo $this->options->button_action_new_tab() ? '_blank' : '_self'; ?>" <?php echo empty($rel) ? '' : "rel=\"$rel\""; ?>><?php echo apply_filters( 'wpml_translate_single_string', $this->options->button_text(), 'admin_texts_wpfront-notification-bar-options', '[wpfront-notification-bar-options]button_text', apply_filters( 'wpml_current_language', NULL ) ); ?></a> 5. Save and translate string from WPML > String translation. Video: hidden link I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you. Regards, |