Need help with language change in navbar
3 posters
Page 1 of 1
Need help with language change in navbar
- Code:
$(function(){ /* Wait for the page to load */
var a_memblist=$("a.mainmenu[href="/memberlist"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("உறுப்பினர்கள்"); /* Change the text to users */
};
var a_memblist=$("a.mainmenu[href="/profile?mode=editprofile"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("பயனர் தகவலறை"); /* Change the text to profile */
}
var a_memblist=$("a.mainmenu[href="/privmsg?folder=inbox"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("தனிமடல்"); /* Change the text to privmsg */
};
var a_memblist=$("a.mainmenu[href="/search"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("தேடுக"); /* Change the text to search */
};
var a_memblist=$("a.mainmenu[href="/login"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("உள்நுழை"); /* Change the text to login */
};
var a_memblist=$("a.mainmenu[href="/register"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("பதிவு செய்"); /* Change the text to register*/
};
var a_memblist=$("a.mainmenu[href="/images"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("சமீபத்திய படங்கள்"); /* Change the text to Images*/
};
var a_memblist=$("a.mainmenu[href="/publi"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("வலைப்பூ"); /* Change the text to Publications*/
};
var a_memblist=$("a.mainmenu[href="/calendar"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("நாட்காட்டி"); /* Change the text to calendar*/
};
var a_memblist=$("a.mainmenu[href="/faq"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("கேள்வி பதில்"); /* Change the text to faq*/
};
var a_memblist=$("a.mainmenu[href="/groups"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("ஈகரை குழு"); /* Change the text to groups*/
};
var a_memblist=$("a.mainmenu[href="/gallery/index.htm"]"); /* The memberlist link */
if(a_memblist){ /* If the memberlist link exists */
a_memblist.text("கேலரி"); /* Change the text to gallery*/
};
if(/faq/.test(location.pathname)){ /* If the user visit the faq */
location.pathname="/forum"; /* Redirect to the forum */
};
})
unable to change the language of the following in the above script.
Home, Logout, New message
Thanks in advance to those who help
Last edited by sivastar on January 25th 2023, 5:16 pm; edited 1 time in total
Re: Need help with language change in navbar
Good afternoon!
AP - Display - Templates - General - overall_header
At the end of the template, insert:
Lalala - replace with your own text
Save - Publish
Result:
Note that the "You have ___ new message" button has three codes to keep the number of new messages and that the code replaces the button not only when there is 1 message, but also when there are more
AP - Display - Templates - General - overall_header
At the end of the template, insert:
- Code:
<script>
document.querySelector('a.mainmenu[href="/"]').innerText=document.querySelector('a.mainmenu[href="/"]').innerText.replace("Home","Lalala");
document.querySelector('span.new-message').innerText=document.querySelector('span.new-message').innerText.replace("You have","Lalala");
document.querySelector('span.new-message').innerText=document.querySelector('span.new-message').innerText.replace("new message","Lalala");
document.querySelector('span.new-message').innerText=document.querySelector('span.new-message').innerText.replace("new messages","Lalala");
document.querySelector('#logout').innerText=document.querySelector('#logout').innerText.replace("Log out","Lalala");
</script>
Lalala - replace with your own text
Save - Publish
Result:
Note that the "You have ___ new message" button has three codes to keep the number of new messages and that the code replaces the button not only when there is 1 message, but also when there are more
Razor12345- Support Moderator
- Posts : 1583
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
sivastar and TonnyKamper like this post
Re: Need help with language change in navbar
Home menu text changed, but logout and new message not working..
Update:
Your script works perfectly only when a new message received.
Otherwise working for the home menu only.
Update:
Your script works perfectly only when a new message received.
Otherwise working for the home menu only.
Re: Need help with language change in navbar
Try this
The problem was that when 1 unread message, one class is assigned to the button, and when two unread messages, another class is assigned.
Where else should the text be changed?
- Code:
<script>
document.querySelector('a.mainmenu[href="/"]').innerText=document.querySelector('a.mainmenu[href="/"]').innerText.replace("Home","Lalala");
document.querySelector('#logout').innerText=document.querySelector('#logout').innerText.replace("Log out","Lalala");
document.querySelector('span.toread-message').innerText=document.querySelector('span.toread-message').innerText.replace("unread message","Lalala");
document.querySelector('span.new-message').innerText=document.querySelector('span.new-message').innerText.replace("You have","Lalala");
document.querySelector('span.new-message').innerText=document.querySelector('span.new-message').innerText.replace("new message","Lalala");
document.querySelector('span.new-message').innerText=document.querySelector('span.new-message').innerText.replace("new messages","Lalala");
</script>
The problem was that when 1 unread message, one class is assigned to the button, and when two unread messages, another class is assigned.
Otherwise working for the home menu only.
Where else should the text be changed?
Razor12345- Support Moderator
- Posts : 1583
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
sivastar likes this post
Re: Need help with language change in navbar
Kindly add the script for "Messages"
The above code working Log out and unread messages, but Home not working
Update:
Something stops working when moving the script up and down
The above code working Log out and unread messages, but Home not working
Update:
Something stops working when moving the script up and down
Re: Need help with language change in navbar
I found the problem - you have a second menu that copies the main menu buttons.
There were also problems with the different display options for the "messages" button
Please, try this code:
There were also problems with the different display options for the "messages" button
Please, try this code:
- Code:
<script>
let ele = document.querySelector('#navbar');
ele.querySelector('a.mainmenu[href="/"]').innerText=ele.querySelector('a.mainmenu[href="/"]').innerText.replace("Home","Lalala");
ele.querySelector('#logout').innerText=ele.querySelector('#logout').innerText.replace("Log out","Lalala");
let mes = ele.querySelector('a.mainmenu[href="/privmsg?folder=inbox"]');
let mes1 = ele.querySelector('span.new-message');
let mes2 = ele.querySelector('span.toread-message');
if ( mes && mes1) {
ele.querySelector('span.new-message').innerText=ele.querySelector('span.new-message').innerText.replace("You have","Lalala");
ele.querySelector('span.new-message').innerText=ele.querySelector('span.new-message').innerText.replace("new message","Lalala");
} else if ( mes && mes2) {
ele.querySelector('span.toread-message').innerText=ele.querySelector('span.toread-message').innerText.replace("unread message","Lalala");
} else {
ele.querySelector('a.mainmenu[href="/privmsg?folder=inbox"]').innerText=ele.querySelector('a.mainmenu[href="/privmsg?folder=inbox"]').innerText.replace("Messages","Lalala");
}
</script>
Razor12345- Support Moderator
- Posts : 1583
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
skouliki, sivastar and كونان2000 like this post
Re: Need help with language change in navbar
Problem solved & topic archived.
|
Similar topics
» how to change language?
» i want change language.
» Language won't change
» how to change the language of the forum
» Language change of widgets?
» i want change language.
» Language won't change
» how to change the language of the forum
» Language change of widgets?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum