WordPress.org

Making WordPress.org

Changeset 7055


Ignore:
Timestamp:
04/06/2018 08:34:50 PM (3 years ago)
Author:
iandunn
Message:

WP15: Internationalize menu item titles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wp15.wordpress.net/public_html/content/themes/twentyseventeen-wp15/functions.php

    r7031 r7055  
    99add_filter( 'get_custom_logo',    __NAMESPACE__ . '\set_custom_logo'         );
    1010add_filter( 'body_class',         __NAMESPACE__ . '\add_body_classes'        );
     11add_filter( 'wp_get_nav_menu_items', __NAMESPACE__ . '\internationalize_menu_items' );
    1112
    1213
     
    103104
    104105/**
     106 * Internationalize the menu item titles.
     107 *
     108 * @param array $items
     109 *
     110 * @return array
     111 */
     112function internationalize_menu_items( $items ) {
     113    foreach ( $items as $item ) {
     114        switch ( $item->title ) {
     115            case 'About':
     116                // translators: The name of the page that describes the WP15 celebrations.
     117                $item->title = esc_html__( 'About', 'wp15' );
     118                break;
     119
     120            case 'Live':
     121                // translators: The name of the page that displays the #wp15 social media posts in real time.
     122                $item->title = esc_html_x( 'Live', 'verb', 'wp15' );
     123                break;
     124
     125            case 'Swag':
     126                // translators: "Swag" is a term for promotional items. This is the title of the page.
     127                $item->title = esc_html__( 'Swag', 'wp15' );
     128                break;
     129        }
     130    }
     131
     132    return $items;
     133}
     134
     135/**
    105136 * Data for the Swag page download items.
    106137 *
Note: See TracChangeset for help on using the changeset viewer.