Problem translating %%page%% variable
-
Without Yoast plugin, all I needed was to translate the wordpress core .po files to my language, which also includes the variables. Page is translated to Σελ?δα in greek, so for Page 2 in any archive page, it’d display Σελ?δα 2 as a title in my browser, which was perfectly fine.
Now with Yoast, there is either the option to have a %%page%% variable with context (“page [no] of [total]”) or %%pagenumber%% which just prints the number (i.e. “2”, NOT “page 2”), which is somewhat confusing. ANYWAY, the thing is that Yoast doesn’t make use of the wordpress translation file now (at least for %%page%%), so it’s in english. I located the phrase in line 903 of
class-wpseo-replace-vars.php
file$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'wordpress-seo' ), $nr, $max );
which I replaced with
$replacement = sprintf( $sep . ' ' . __( 'Σελ?δα %1$d απ? %2$d', 'wordpress-seo' ), $nr, $max );
Strangely now, instead of displaying ‘Σελ?δα 2 απ? 150’, it just displays ‘2/150’. Not to mention other things broken, like the blog page title using the homepage title template (?!?). WTF, all I did was replace two words.
So my question would be, how can we properly translate the %%page%% variable, and/or is there a way to just use the original wordpress variable for page which just displayed ‘page [no]’ when the current page was >1.
- The topic ‘Problem translating %%page%% variable’ is closed to new replies.