#2595 closed defect (bug) (fixed)
Titles are not localized in bp_get_page_title()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 1.5 | Priority: | normal |
Severity: | normal | Version: | 1.2.5 |
Component: | Core | Keywords: | |
Cc: | sergeybiryukov.ru@… |
Description
In several cases bp_get_page_title()
returns untranslated string, which is caused by passing an incorrect argument to the __()
function.
For a post: ... | Blog | ...
For a category: ... | Blog | Categories | ...
For a tag: ... | Blog | Tags | ...
For a user: ... | Activity
Attachments (3)
Change History (19)
#2
@
14 years ago
- Summary changed from Titles are not localized in bp_get_page_title() to [patch] Titles are not localized in bp_get_page_title()
#5
@
14 years ago
- Summary changed from [patch] Titles are not localized in bp_get_page_title() to Titles are not localized in bp_get_page_title()
I just tried to create a new patch for this issue for trunk, but discovered that core doesn't create a Page for components that aren't root level, such as the Friends component, which is holding up this ticket.
#10
@
14 years ago
I don't like the way this function has constructed its title string so far. Whilst the refreshed patch looks okay (I've not tested it), I'm going to play with an alternative approach; an idea I'm going to try is perhaps we should add a "page_title" attribute to the component class.
#14
@
13 years ago
- Severity changed from normal to critical
- Type changed from defect (bug) to enhancement
- Version 1.2.5 deleted
And so, I made corrections in analogy with 1.2 version of buddypress.
Fixes for 1.5:
bp-core/bp-core-filters.php:
$title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), ucwords( bp_current_component() ) ) );
replace:
$title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->displayed_user->fullname, __( ucwords( $bp->current_component ), 'buddypress' ) ) );
$title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[$bp->current_item][$bp->current_action]['name'], bp_get_name_from_root_slug( bp_get_root_slug() ) );
replace:
$title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), __( bp_get_name_from_root_slug(), 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'] );
$title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( bp_members_slug() ) ); else $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( bp_get_root_slug() ) );
replace:
$title = sprintf( __( '%s Directory', 'buddypress' ), __( ucwords( $bp->members->slug ), 'buddypress' ) ); else $title = sprintf( __( '%s Directory', 'buddypress' ), __( bp_get_name_from_root_slug(), 'buddypress' ) );
Patch looks pretty good, but rather than using $bp->current_component in the title of single item pages, we now need to be using the Page name from the DB.