Skip to:
Content

BuddyPress.org

Changeset 4194


Ignore:
Timestamp:
04/10/2011 11:49:56 AM (14 years ago)
Author:
djpaul
Message:

Improve page title i18n. Fixes #2595, #2555. Props for initial patches to SergeyBiryukov and sorich87.

Also fixes a couple of possible PHP notices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template.php

    r4192 r4194  
    221221    global $bp, $post, $wp_query;
    222222
     223    $title = '';
     224
    223225    // Home
    224226    if ( is_front_page() || ( is_home() && bp_is_page( 'home' ) ) ) {
     
    228230    } elseif ( bp_is_blog_page() ) {
    229231        if ( is_single() ) {
    230             $title = __( 'Blog | ' . $post->post_title, 'buddypress' );
     232            $title = sprintf( __( 'Blog | %s', 'buddypress' ), $post->post_title );
    231233        } else if ( is_category() ) {
    232             $title = __( 'Blog | Categories | ' . ucwords( $wp_query->query_vars['category_name'] ), 'buddypress' );
     234            $title = sprintf( __( 'Blog | Categories | %s', 'buddypress' ), ucwords( $wp_query->query_vars['category_name'] ) );
    233235        } else if ( is_tag() ) {
    234             $title = __( 'Blog | Tags | ' . ucwords( $wp_query->query_vars['tag'] ), 'buddypress' );
     236            $title = sprintf( __( 'Blog | Tags | %s', 'buddypress' ), ucwords( $wp_query->query_vars['tag'] ) );
    235237        } else if ( is_page() ){
    236238            $title = $post->post_title;
     
    240242    // Displayed user
    241243    } elseif ( !empty( $bp->displayed_user->fullname ) ) {
    242         $title = strip_tags( $bp->displayed_user->fullname . ' | ' . ucwords( $bp->current_component ) );
     244        // translators: "displayed user's name | canonicalised component name"
     245        $title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->displayed_user->fullname, ucwords( bp_current_component() ) ) );
    243246
    244247    // A single group
    245     } elseif ( !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) {
    246         $title = $bp->bp_options_title . ' | ' . $bp->bp_options_nav[$bp->groups->current_group->slug][$bp->current_action]['name'];
     248    } elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) {
     249        // translators: "group name | group nav section name"
     250        $title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[$bp->groups->current_group->slug][$bp->current_action]['name'] );
    247251
    248252    // A single item from a component other than groups
    249253    } elseif ( bp_is_single_item() ) {
    250         $title = bp_get_name_from_root_slug() . ' | ' . $bp->bp_options_title . ' | ' . $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'];
     254        // translators: "root component name | component item name | component nav section name"
     255        $title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), bp_get_name_from_root_slug(), $bp->bp_options_title, $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'] );
    251256
    252257    // An index or directory
    253258    } elseif ( bp_is_directory() ) {
    254259        if ( !bp_current_component() )
    255             $title = sprintf( __( '%s Directory', 'buddypress' ), ucwords( $bp->members->slug ) );
     260            $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( $bp->members->slug ) );
    256261        else
    257262            $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );
     
    655660 *
    656661 * @since BuddyPress {r3923}
    657  * @global obj $bp
     662 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
    658663 * @param str $root_slug Needle to our active component haystack
    659664 * @return mixed False if none found, component name if found
    660665 */
    661666function bp_get_name_from_root_slug( $root_slug = '' ) {
     667    global $bp;
    662668
    663669    // If no slug is passed, look at current_component
    664     if ( empty( $root_slug ) ) {
    665         global $bp;
     670    if ( empty( $root_slug ) )
    666671        $root_slug = $bp->current_component;
    667     }
    668672
    669673    // No current component or root slug, so flee
Note: See TracChangeset for help on using the changeset viewer.