Translate text or html string inside a jquery file
-
Hi to all.
I have translated many strings of the wp theme I’m using with pll__ or pll_e in some php files.
After several attempts, I can not translate this text string ‘Posts Loading …’ contained within main.js file.
jQuery('.load-more a').click(function() {
// Are there more posts to load?
if (pageNum <= max && !loading) {
loading = true;
// Show that we're working.
jQuery(this).text('Loading posts...');
jQuery.get(nextLink, function(data) {
// Update page number and nextLink.
pageNum++;
if (nextLink.indexOf("paged=") > 0) nextLink = nextLink.replace(/paged=[0-9]*/, 'paged=' + pageNum);
else nextLink = nextLink.replace(/\/page\/[0-9]*/, '/page/' + pageNum);var items = Array();
var $newItems = jQuery('.element', data);I tried to follow some tips on how to use php code within a js file, but I could not solve my problem.
Thanks to anyone who can help me.
Bye
PS
Of course if WordPress Support Forums in the future to provide a specific search in plugin threads, would avoid a lot of double requests.
- The topic ‘Translate text or html string inside a jquery file’ is closed to new replies.