Site logo

Archived topic

nav-links how to translate without plugin

11 replies · Started by Emil on September 28, 2021

Viewing posts 1–12 of 12

Hello, please help me with translate "nav-link" in blog on test page (Prv information)
I want translate 'Next' 'Pervious" for my language.

Best Regards

I added this code like a new snippet but it doesn't work on my site. Now this snippet is working, please check it.

Just to confirm, are you using Code Snippets plugin to add the code?

Can you clear and disable LiteSpeed cache first?

Thanks :)

Hello, unfortunately I have still a problem - I disabled LiteSpeed and try delete cookies, cache my browser and I still see 'next' 'previous' :(

I used the "Snippets" plugin. I also tried to change the priority.

[url=https://ibb.co/HHNpMvd][img]https://i.ibb.co/5RYxzDF/Zrzut-ekranu-2021-11-8-o-06-54-45.png[/img][/url]

I see.

The code seems correct.

If you try this:

add_filter( 'gettext', function( $text ) {
    if ( 'Previous' === $text ) {
        $text = 'Następny';
    }

    if ( 'Next' === $text ) {
        $text = 'Poprzedni';
    }

    return $text;
}, 10 ,1 );

If it doesn't work, can you try it with ALL plugins disabled except for GP Premium and Code Snippets plugin? To check if it's in conflict with a plugin.

Also, it's possible that your site is being object cached or page cached. In this case, can you try and make sure all forms of cached are disabled and/or purged?

Note: You may have to ask your hosting if they have this sort of feature implemented.

I try this code and still have a problem :(
I have disabled all plugins, I am trying to use only your plugin + woocommerce and still don't have navigation links not translated. I provide login and password for wp-admin.

Ah I see what the issue is now.

The code should've been this:

add_filter( 'gettext', function( $text ) {
    if ( '%s Previous' === $text ) {
        $text = '%s Następny';
    }

    if ( 'Next %s' === $text ) {
        $text = 'Poprzedni %s';
    }

    return $text;
}, 10 ,1 );

We missed the %s for the archive pages. The previous code was for single post navigation.

I did the change for your site to test. It should be working now as shown here - https://share.getcloudapp.com/ApuEEn87

Oww! :) Thank you! Your support is awesome.

No problem. Glad to be of any help. :D

This archived topic is closed to new replies.