Jump to content

Translate inside file javascript


roman.b

Recommended Posts

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

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

  • 2 weeks later...
  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...