• Hello,
    First thank you for your plugin and help.

    I have a SIGN IN, SIGN OUT and another page link IN MY MENU, THESE HAS BEEN ADDED FROM THE functions.php file and ofcourse i can’t see it in the wp-admin menus
    So i can’t translate it from there

    Is there any way to translate it from the fonctions.php file to switch between the 2 languages?

    Here below the code in the functions file and the changes i have done:

    
    function add_login_logout_register_menu( $items, $args ) {
     if ( $args->theme_location != 'primary' ) {
     return $items;
     }
     
     if ( is_user_logged_in() ) {
     $items .= '<li><a href="' . get_page_link('25026') . '">' . __( 'Spin Dashboard' ) . '</a></li>';
     $items .= '<li><a href="' . get_page_link('37') . '">' . __( 'My Account' ) . '</a></li>';
     $items .= '<li><a href="' . get_page_link('24842') . '">' . __( 'Sign Out' ) . '</a></li>';
     } else {
     $items .= '<li><a href="' .  get_page_link('37').'">' . __( 'Sign In' ) . '</a></li>';
      
       }
    
    

    CHANGES I DID:

    
    if ( is_user_logged_in() ) {
     $items .= '<li><a href="' . pll_get_post('25026') . '">' . pll__( 'Spin Dashboard','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . pll_get_post('37') . '">' . pll__( 'My Account','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . pll_get_post('24842') . '">' . pll__( 'Sign Out','thegem' ) . '</a></li>';
     } else {
     $items .= '<li><a href="' .  pll_get_post('37').'">' . pll__( 'Sign In','thegem' ) . '</a></li>';
       }  
    

    But links are broken Now on my web page

    I’m not a programer so please any advice about how to manage this? is it correct to keep the page ID as i did (ex: pll_get_post(’37’) or do i have to put something else

    I can’t see Sign In, Sign out etc… in Strings translation in wp-admin
    I can’t see them in Loco Translate

    Wordpress: 4.9.4
    Polylang: 2.3.4
    Loco Translate: 2.1.3
    PHP: 7
    Theme: thegem

    Thank you in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • anonymized-13603639

    (@anonymized-13603639)

    You will translate your theme. Polylang helps you to translate content. These are two different things.
    So, you have to use gettext for translation and follow the instruction how to create PO/MO files.
    Google will help you.

    • This reply was modified 8 years, 1 month ago by anonymized-13603639.
    Thread Starter wm44

    (@wm44)

    Hello,
    Thank for your message,
    My theme is already translated, all PO/MO files are there and all links and pages are working fine.

    My issue is only what i mentioned above this part that has been added to the primary menu from the functions.php file “Sign In and Sign Out plus one extra page”

    anonymized-13603639

    (@anonymized-13603639)

    Please understand, all text you add in your functions.php is also part of the theme and needs to be translated by PO/MO files. Change this line
    __( 'Spin Dashboard' )
    to
    __( 'Spin Dashboard','my-text-domain' )
    and you can translate this part with your theme translation.

    Thread Starter wm44

    (@wm44)

    Yes that’s what i mentionned above it has been done, i already sent in my first message the changes i did, here it’s again: my-text-domain

    
    if ( is_user_logged_in() ) {
     $items .= '<li><a href="' . pll_get_post('25026') . '">' . pll__( 'Spin Dashboard','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . pll_get_post('37') . '">' . pll__( 'My Account','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . pll_get_post('24842') . '">' . pll__( 'Sign Out','thegem' ) . '</a></li>';
     } else {
     $items .= '<li><a href="' .  pll_get_post('37').'">' . pll__( 'Sign In','thegem' ) . '</a></li>';
       }  
    

    Sign In, Sign Out, Spin Dashboard don’t appear in the PO file even after sync and not in Loco Translate

    Thank you anyway
    and have a good day

    anonymized-13603639

    (@anonymized-13603639)

    You should follow my message and do as I described. And don’t add other code.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Translate custom Menu from Functions’ is closed to new replies.