Errorneous URLs generated for ‘Previous’ link on a localized site
-
Hi TEC, I ran into an issue with the URL generated for the ‘Next’ and ‘Previous’ links on the event list pages being invalid. This is an issue only when the site language is set to Slovak, set to English it’s working.
The linked URL for ‘Previous’ looks like this:
https://___.sk/(/?:events|eventsx)/(/?:list)/&eventDisplay=past
Looks like a template does not get processed. I tracked down the problem as much as I could, to an exact function where it happens. The issue has 2 parts, I’ll describe it.
1. Link template
File: /wp-content/plugins/the-events-calendar/common/src/Tribe/Rewrite.php
Line: 556
Code:$replaced = str_replace( array_keys( $replace ), $replace, $link_template );
At this line the variables are the following:
$replace:
array(5) {
["(?:month|mesiac)"]=> string(6) "mesiac"
["(?:list|zoznam)"]=> string(6) "zoznam"
["(?:today|dnes)"]=> string(4) "dnes"
["(?:day|den|deň|de%c5%88|DE%C5%88)"]=> string(8) "de%c5%88"
["(?:events|udalosti)"]=> string(8) "udalosti"
}
(Note: “udalosti” is the Slovak translation of the word ‘events’.)$link_template:
string(30) "(?:events|eventsx)/(?:list)/?$"
(Note: “events” is the current slug, “eventsx” is the previous slug)Looks like the
"(?:events|udalosti)"
term in the array is supposed to match"(?:events|eventsx)"
in the second string. The result is that the template parts do not get replaced. As I see, for this purpose thestr_replace
function is not the right match.2. The chosen slug is being translated
I set a slug for the event calendar, and I see it being translated to the site language. This is something that should not happen.
Thanks in advance for dealing with this. I’ll provide as much information as I can.
Gabriel
- The topic ‘Errorneous URLs generated for ‘Previous’ link on a localized site’ is closed to new replies.