antasz Posted May 18, 2023 Share Posted May 18, 2023 Hi, I would like to ask help with the following: On this bilingual site, I would like to translate the words "Prev" and "Next" ("Előző" and "Következő") at the bottom of blog posts under the Hungarian news (e.g. https://www.baem.hu/hirek/2023/01/30/folytattuk-az-egyuttmukodest-az-iaeste-szervezetevel), even if there is a link on them, but also if they are the first or last posts, i.e. there are without links. There is an English news site which is also a blog, there you should keep the words "Prev" and "Next". Thanks Link to comment
dankamminga Posted May 21, 2023 Share Posted May 21, 2023 I have the same problem. I have the bilingual setting set to dutch but there is still a lot of english. How can I change that? Link to comment
antasz Posted May 30, 2023 Author Share Posted May 30, 2023 @dankamminga , here is the script what I'm using. With this solution, if there is no Previous or Next link, it will not be displayed, i.e. it will not say Previous or Next. Maybe it helps you. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function() { var currentUrl = window.location.href; if (currentUrl.includes("/hirek/")) { var pagination = $('.pagination'); var prevLink = pagination.find('a:contains("Prev")'); var nextLink = pagination.find('a:contains("Next")'); var prevText = pagination.contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() === 'Prev /'; }); var nextText = pagination.contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() === '/ Next'; }); if (prevLink.length > 0) { prevLink.text('Előző'); } else if (prevText.length > 0) { prevText[0].textContent = 'Előző / '; prevText[0].nodeValue = ''; // kitörli ha nincs is előző } if (nextLink.length > 0) { nextLink.text('Következő'); } else if (nextText.length > 0) { nextText[0].textContent = ' / Következő'; nextText[0].nodeValue = ''; // kitörli ha nincs is következő } } }); </script> Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment