I have this script running on a Japanese directory, working to replace English terms on the page for a Blog add-on for the terms that were not customizable. It works great but it only seems to replace the term the first time it sees it.
http://www.martyregan.com/jp/blog/
For example you'll see View Post, Tags, Feb are still in English on the bottom Blog Post.
Here's the script:
$(document).ready(function(){
$('#pb_sidebar, #left-sidebar-inner, #pb_body, #main-content-inner, #sidebar-archives').each(function(i){
$(this).html($(this).html().replace('Category List','ブログテーマ一覧'));
$(this).html($(this).html().replace('Tag List','タグ'));
})
})
How can I alter it so that it grabs the term everywhere it sees it? Thanks!
You need to use regex with the /g option that will repeat otherwise string.replace() only runs once.
For example:
$(this).html($(this).html().replace(/Category List/g,'ブログテーマ一覧'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With