Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#2595 closed defect (bug) (fixed)

Titles are not localized in bp_get_page_title()

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: djpaul's profile DJPaul
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)

2595.patch (1.8 KB) - added by SergeyBiryukov 14 years ago.
2595.2.patch (2.3 KB) - added by SergeyBiryukov 14 years ago.
2595.3.patch (2.4 KB) - added by SergeyBiryukov 14 years ago.
Added sprintf() for proper RTL support

Download all attachments as: .zip

Change History (19)

#1 @SergeyBiryukov
14 years ago

  • Keywords has-patch added

#2 @paulhastings0
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()

#3 @DJPaul
14 years ago

  • Owner set to DJPaul
  • Status changed from new to assigned

#4 @DJPaul
14 years ago

  • Keywords needs-patch added; has-patch removed

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.

#5 @DJPaul
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.

#6 @SergeyBiryukov
14 years ago

  • Cc SergeyBiryukov removed

#7 @SergeyBiryukov
14 years ago

  • Cc sergeybiryukov.ru@… added

#8 @SergeyBiryukov
14 years ago

  • Version set to 1.2.5

#9 @SergeyBiryukov
14 years ago

Refreshed the patch.

#10 @DJPaul
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.

@SergeyBiryukov
14 years ago

Added sprintf() for proper RTL support

#11 @DJPaul
14 years ago

See also #2555

#12 @djpaul
14 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4194]) Improve page title i18n. Fixes #2595, #2555. Props for initial patches to SergeyBiryukov and sorich87.

Also fixes a couple of possible PHP notices.

#13 @RuBAN-GT
13 years ago

  • Severity set to normal

How to apply it to 1.5?

#14 @RuBAN-GT
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' ) );

#15 @boonebgorges
13 years ago

  • Keywords needs-patch removed
  • Severity changed from critical to normal
  • Type changed from enhancement to defect (bug)

RuBAN-GT - Thanks for the patches, but can you keep them to a single ticket? Let's use #3731 for this purpose.

#16 @SergeyBiryukov
13 years ago

  • Version set to 1.2.5
Note: See TracTickets for help on using tickets.