• Resolved drrxbracho

    (@drrxbracho)


    The pagination block in twentytwentythree has two other blocks, for next and previous posting. The strings are set to “Newer Posts” and “Older Posts” and, upon inspection of wp-includes/blocks/query-pagination-next.php, it calls esc_html() instead of esc_html__() which would translate the strings.

    I don’t know where to file this bug but, more importantly, I don’t know how to build a child theme or whether that would work (it is not in the theme’s directory structure but in wp-includes).

    What should I do to fix the problem so it’s not overwritten when a new version of either WordPress or twentytwentythree is released?

    Rafael

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator jordesign

    (@jordesign)

    Hi @drrxbacho – thanks for reporting this.

    May I ask – do you see this same issue when you try other default themes like TwentyTwentyTwo or TwentyTwentyOne?

    If it effects them consistently – it definitely sounds like this might be something we need to report in WordPress core to make sure it gets resolved (this seems likely if it is included in wp-includes).

    Thread Starter drrxbracho

    (@drrxbracho)

    Thank you for replying, @jordesign

    I only have twentytwentythree loaded but other themes may not show the problem because it depends on how the query-pagination blocks are called.

    In the template home.html of twentytwentythree, they are called with the strings “Newer Posts” and “Older Posts” which, as I mentioned, are not translated. That said, the default strings are translated, so if another theme didn’t override the default, the bug will not show up.

    I don’t have a sandbox where to test changes, but I believe it’s a matter of modifying the blocks query-pagination-next and -previous to call esc_html__() instead of esc_html()

    Rafael

    Thread Starter drrxbracho

    (@drrxbracho)

    One more thing, my site just updated to WordPress 6.4 and the erroneous code (according to my sleuthing which could be faulty) is still there.

    Rafael

    Thread Starter drrxbracho

    (@drrxbracho)

    I got a reply on the WordPress core forum explaining that my sleuthing, as I called it, was indeed faulty because the gettext functions may only be called with static strings, so the pseudo code in the template home.html:

    <!-- wp:query-pagination-next {"label":"Older Posts"} /-->

    should be passing the translated string. In other words, they say that the translation has to be done by the theme.

    Anybody has any ideas?

    Rafael

    Moderator jordesign

    (@jordesign)

    Hi @drrxbracho,

    I’ve also checked in with some folks – and as those text strings are editable within the theme itself (you can click on it and change the text) that is (for now) the best way to do that.

    At the same time – I’ve opened a Feature Request to have the main problem resolved in the blocks themselves.

    https://github.com/WordPress/gutenberg/issues/55983

    Thread Starter drrxbracho

    (@drrxbracho)

    Hi @jordesign

    I had no idea the strings were editable, it didn’t occur to me to try! With that, I have a workaround: I duplicate the blocks, a set for each language with exclusive visibility when it is the default language. So, I’ll just have double pagination-next and -previous blocks.

    In general, the whole issue of internationalization with block themes is very weak, but the blocks themselves help kludge something that works. I’m sure there are efficiency penalties, etc.

    Thanks for the help, I’ll close the issue.

    Rafael

    PS. I just went to GitHub, the issue you opened, and the response will be that calling esc_html__() is an error when called with non-static strings, a feature of how gettext() works, it seems. What the block needs is an overall I18N strategy for block themes, I think.

    • This reply was modified 6 months, 3 weeks ago by drrxbracho. Reason: Added the PS

    I had the same issue. Can’t you just remove the custom text from the theme so that the default label will be used? That will solve the issue for everyone who uses this theme without upstream changes?

    The option to add custom text is nice, but as this is a default WordPress theme, it should have sensible defaults.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.