roman.b Posted September 18, 2018 Share Posted September 18, 2018 Hello, I need to translate this "More" (in file blocktopmenu.js) code: var max_elem = 5; var items = $('ul.sf-menu > li'); var surplus = items.slice(max_elem, items.length); surplus.wrapAll('<li class="level0 level-top hiden_menu"><ul class="level0">'); $('.hiden_menu').prepend('<a href="#" class="level-top">More</a>'); $('.hiden_menu').mouseover(function(){ $(this).children('ul').addClass('shown-sub'); }) This solution does not work: https://www.prestashop.com/forums/topic/176156-translation-inside-a-js/ Link to comment Share on other sites More sharing options...
Andrej Stas Posted September 19, 2018 Share Posted September 19, 2018 What if you inserted <a href="#" class="level-top">More</a> into a .tpl file (where you can translate it easily) and then only referenced it from the JS file? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted September 19, 2018 Share Posted September 19, 2018 You can translate the same using the following method. Add this line just above the shared code var more_info = "{l s='More' mod='blocktopmenu'}"; & replace the more line with this one. $('.hiden_menu').prepend('<a href="#" class="level-top">' + more_info + '</a>'); Now go to the admin. I hope text will be available to translate. Link to comment Share on other sites More sharing options...
roman.b Posted October 2, 2018 Author Share Posted October 2, 2018 Thanks for the answers, unfortunately, this is not a solution The author of the code found a solution. Thanks and regards Roman Link to comment Share on other sites More sharing options...
Inter Svetainė Posted October 5, 2020 Share Posted October 5, 2020 @roman.b could You share solution with everyone here? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now