register_nav_menus question

Hi,

I want to register some new menu’s, and see this is happening in Roots:

      // Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus)
  register_nav_menus(array(
    'primary_navigation' => __('Primary Navigation', 'roots'),
  ));

When I read the codex I expected it to be:

 'primary_navigation' => 'Primary Navigation'

but instead it is:

‘primary_navigation’ => __(‘Primary Navigation’, ‘roots’)

What is the difference between those?

Kind regards,

Willem

It’s so that the name of the menu can be translated/localised:

__('String to be be translated', 'domain'); // returns translated string
_e('String to be be translated', 'domain'); // echos translated string

It’s a good practice to get used to but not mandatory if your site/theme/plugin will only be available in one language.

Thanks. I’m new to theme developement, so I didn’t know this. Since I almost always use WPML, this is a good thing to know.