Say I have a piece of custom JavaScript loaded in some pages of my store. This JavaScript serves the purpose of interactivity and can display some text. How would I make it multi-langual like I would with the __("string"); format in PHP?
Say i.e. I have this piece of JavaScript:
$('.readmorebutton').click(function() {
if (! $('.readmore').hasClass('open') ) {
$('.readmorebutton').text('Show less'); //How to translate?
} else {
$('.readmorebutton').text('Read More'); //How to translate?
}
});
note: JS is taken out of context and stripped down; the working of it is not the issue, the translating of the text is.