• Resolved gugax

    (@gugax)


    Hi,

    I’m finding some strings in Members page that I’m not able to translate

    I’m using Loco Translate plugin, and so far i was able to translate multiple strings in different pages and forms to a second language. Few days ago i detected a string that was not being able to translate and a bug was open (reference ticket here).

    Today i have found additional strings in Members page that are not being translated. I find the strings in Loco Translate plugin, I apply the translated string but when selecting the language in my website the translation does not come, it shows in english (original language).

    The strings with that i’m not able to translate are:
    “We are sorry. We cannot find any users who match your search criteria.”
    “{total_users} Member”
    “{total_users} Members”

    Could you please investigate and help me out here?

    Thank you for your support.

Viewing 13 replies - 16 through 28 (of 28 total)
  • @gugax

    You can remove your current code snippet and install this plugin:

    https://github.com/MissVeronica/um-polylang-ajax

    Thread Starter gugax

    (@gugax)

    Hi @missveronicatv thank you for this. However still facing same issue.
    I have the right directory structure in my child theme (otherwise logs before wouldn’t appear). I removed the code snippet from my functions.php file and isntalled plugin and still face same behaviour.

    Do you know if there a way to debug this? I start thinking that could be theme issue, however, not sure, as other strings from plugin are translated.

    @gugax

    Which theme are you using?

    Thread Starter gugax

    (@gugax)

    Hestia Theme (free version)

    @gugax

    Try to replace the last function in the plugin code in this folder:
    .../plugins/um-polylang-ajax-main
    for logging of variables to debug.log

    public function um_ajax__pll_preferred_language( $slug, $cookie ) {  
    
            file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL referer: ' . wp_get_referer() . chr(13), FILE_APPEND );
            file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL lang in: ' . $slug . chr(13), FILE_APPEND );
            if ( defined( 'DOING_AJAX' ) && DOING_AJAX && is_user_logged_in() ) {
                if ( $cookie ) {
                    file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL we have a cookie, use cookie lang: ' . $slug . chr(13), FILE_APPEND );               
                    
                    if ( ! strpos( wp_get_referer(), '/' . $slug . '/' )) {
                        $slug = pll_default_language( 'slug' );
                        file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL lang not in referer URL' . chr(13), FILE_APPEND );
                        file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL use default lang: ' . pll_default_language( 'slug' ) . chr(13), FILE_APPEND );
                    } else {
                        file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL use lang in referer URL' . chr(13), FILE_APPEND );
                    }
                    
                } else {
                    file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL no cookie found' . chr(13), FILE_APPEND );
                    file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL is using browser lang: ' . $slug . chr(13), FILE_APPEND );
                }
    
            } else {
                file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL not in Ajax or user not logged in' . chr(13), FILE_APPEND );
            }
            file_put_contents( WP_CONTENT_DIR . '/debug.log', 'PLL lang out: ' . $slug . chr(13) . '***' . chr(13), FILE_APPEND );
            return $slug;
        }
    Thread Starter gugax

    (@gugax)

    @missveronicatv, please find below the logs:

    Actions:

    1. Navigate to home page
    2. Login with user admin (was redirected to wp-admin)
    3. Navigate to page “Members”
    4. Search for user
    5. Change language to EN
    6. Navigate to page “Members”
    7. Search for user
    PLL referer: 
    PLL lang in: 
    PLL not in Ajax or user not logged in
    PLL lang out: 
    ***
    PLL referer: 
    PLL lang in: 
    PLL not in Ajax or user not logged in
    PLL lang out: 
    ***
    PLL referer: https://localhost/mywebsite/wp-admin/
    PLL lang in: pt
    PLL not in Ajax or user not logged in
    PLL lang out: pt
    ***
    PLL referer: https://localhost/mywebsite/membros/
    PLL lang in: pt
    PLL we have a cookie, use cookie lang: pt
    PLL lang not in referer URL
    PLL use default lang: pt
    PLL lang out: pt
    ***
    PLL referer: https://localhost/mywebsite/membros/?search_3da9c=a
    PLL lang in: pt
    PLL we have a cookie, use cookie lang: pt
    PLL lang not in referer URL
    PLL use default lang: pt
    PLL lang out: pt
    ***
    PLL referer: https://localhost/mywebsite/en/members/
    PLL lang in: en
    PLL we have a cookie, use cookie lang: en
    PLL use lang in referer URL
    PLL lang out: en
    ***
    PLL referer: https://localhost/mywebsite/en/members/?search_3da9c=a
    PLL lang in: en
    PLL we have a cookie, use cookie lang: en
    PLL use lang in referer URL
    PLL lang out: en
    ***

    @gugax

    You can download and update the plugin which is a rewrite of the code after your last test log.

    https://github.com/MissVeronica/um-polylang-ajax

    Thread Starter gugax

    (@gugax)

    Hi @missveronicatv sorry for late response but couldn’t connect earlier.

    I’ve installed the new plugin but i’m having weird behaviour in my website.

    I have on my top bar the language flags to select the language. I noticed that english language disappeared from the menu, so i went back to my list of pages and i see that “Members” page that was in english version was set to portuguese version.

    So i changed it back to english and did another test:

    1. Go to homepage (by default pt-PT language is selected)
    2. Go to”Members” page, the page is translated except the strings mentioned before in this ticket (i.e. issue remains).
    3. Select english language from the menu which by defaultr edirects me to homepage and noticed that portuguese flag disappeared (new issue).
    4. Go to”Members” page and i see the page is translated in portuguese even i’m using english language.
    5. Go to WP-Admin and click on pages and i noticed that my “Members” page that was in english is now set in portuguese automatically (new issue), meaning 2 pages members in portuguese.
    6. I edited the “members” page to be in english language and if i start the step from 1. all happens again.

    if i disabled the plugin the two new issues don’t occur.

    Workaround, almost:

    So i created two “Member Directories” forms. The goal is to load one in portuguese page and another in english page (not sure if i already should have done this). With this i can manipulate the 3 strings that weren’t able to translate before as i can put the text i desired. What is the issue? For some reason the fields that i want to display to sort and search and also the remaining page is showing all the fields in portuguese. Do you know what can i do to show them in english?

    @gugax

    Make line 28 in the plugin a PHP comment and add //

    //add_filter( 'pll_preferred_language', array( $this, 'um_ajax__pll_preferred_language' ), 10, 2 );

    Plugin Support andrewshu

    (@andrewshu)

    Hi @gugax

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards

    Thread Starter gugax

    (@gugax)

    Hi @andrewshu @missveronicatv

    Apologies late response but didn’t work on this last days. I have commented the line and the issue had before with the languages disappeared, but i’m still facing issue with translating the mentioned strings.

    Can you keep supporting this? I completly lost hopes with this bug. Not sure how no one got this before.

    Thanks

    @gugax

    Now you have an update again to the plugin.
    The plugin is now giving during the Ajax processing English texts earlier to Polylang.
    Another change is you will find the Group “Polylang UM Members Directory” for the translations.

    https://github.com/MissVeronica/um-polylang-ajax

    • This reply was modified 1 year, 6 months ago by missveronica.
    • This reply was modified 1 year, 6 months ago by missveronica.
    • This reply was modified 1 year, 6 months ago by missveronica.
    Thread Starter gugax

    (@gugax)

    Hi @missveronicatv still same behaviour. Please note the settings i have
    – 2 pages for members (1 in pt and 1 in en)
    – Both pages are using same members directory form
    – I’m using polylang to switch languages in my website which is being working so far for the ultimate member pages and strings except members directory form
    – i wanted to avoid to create two members directory form just with 2 different languages. Even if i do, i believe it is not possible as when i tried it in members directory form settings i couldn’t find english strings as my admin is now in portuguese.
    – New weird behaviour in my WP admin, not sure if it is being impacted now by this new plugin, as i desactivated and still face the issue, but now i can’t change the wp-admin page to another language. it is in portuguese.

    Thanks

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘Issues with Members page translations’ is closed to new replies.