Title: Adding string translation custom function
Last modified: September 14, 2018

---

# Adding string translation custom function

 *  [Stephen B](https://wordpress.org/support/users/wordpmoon12/)
 * (@wordpmoon12)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/adding-string-translation-custom-function/)
 * I want to translate a custom function that adds “Log in/out” menu items for Woocommerce.
   
   The problem is that I am not sure what is the correct way to register the strings.
 * This is the function
 *     ```
       add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
   
       function add_loginout_link( $items, $args ) {
   
          if (is_user_logged_in() && $args->theme_location == 'grve_top_right_nav') {
   
              $items .= '<li><a href="'. wp_logout_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) .'">Log Out</a></li>';
   
          }
   
          elseif (!is_user_logged_in() && $args->theme_location == 'primary') {
   
              $items .= '<li><a href="' . get_permalink( woocommerce_get_page_id( 'myaccount' ) ) . '">Log In</a></li>';
   
          }
   
          return $items;
   
       }
       ```
   
 * In my case, I need to translate the words “log out” and “log in”
 * I understand that I have to use pll_register_string in my functions.php but not
   sure how to use.
 * Any help would be much appreciated, thanks!

Viewing 1 replies (of 1 total)

 *  [codestylist](https://wordpress.org/support/users/codestylist/)
 * (@codestylist)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/adding-string-translation-custom-function/#post-10693008)
 * You find everything you need here: [https://polylang.wordpress.com/documentation/documentation-for-developers/](https://polylang.wordpress.com/documentation/documentation-for-developers/)

Viewing 1 replies (of 1 total)

The topic ‘Adding string translation custom function’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [register](https://wordpress.org/support/topic-tag/register/)
 * [string](https://wordpress.org/support/topic-tag/string/)

 * 1 reply
 * 2 participants
 * Last reply from: [codestylist](https://wordpress.org/support/users/codestylist/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/adding-string-translation-custom-function/#post-10693008)
 * Status: not resolved