• Hey, I’m looking for a way to translate php generated text, based on the selected language.

    I want this code to show login/logout information to user in his langauge.

    Can you help me?

    <!-- START DK-->
    <?php
      // If user is logged in and the language is DK, echo in DK / EN
      if (is_user_logged_in() . icl_laguage=='dk'){
          echo "Velkommen, "; // Echo in DK / EN
    
      // Get user information
      global $current_user;
            get_currentuserinfo();
    
            echo $current_user->user_firstname . "\n"; // Get first name
            echo '<a href="https://skipthedanish.com/da/min-konto" title="Se din kontoinformation">Konto</a>'; // Echo in DK / EN
            echo '<a href="'. wp_logout_url( home_url() ) .'">Log ud</a>'; // Echo in DK / EN
    
      // If user is not logged in, echo in DK / EN
      } else {
          echo 'Er du en tidligere kunde? ' . '<a href="https://skipthedanish.com/my-account" title="Log ind i din kundekonto">Log ind</a>'; //  Echo in DK / EN
      };
    ?>
    <!-- END DK-->

  • The topic ‘Login/out information based on language’ is closed to new replies.