From 426cda5e1ffd365b6b8915e8d504c0a6672339d3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 2 Nov 2010 13:42:33 -0700 Subject: [PATCH 1/2] Alternate pretty-title tweaks for #2668 --- actions/showstream.php | 10 ++++------ classes/Profile.php | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/actions/showstream.php b/actions/showstream.php index fb5b061fbe..de66bc415a 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -63,18 +63,16 @@ class ShowstreamAction extends ProfileAction function title() { - if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->user->nickname . ') '; - } else { - $base = $this->user->nickname; - } + $base = $this->profile->getFancyName(); if (!empty($this->tag)) { - $base .= sprintf(_(' tagged %s'), $this->tag); + // TRANS: Page title showing tagged notices in one user's stream. Param 1 is the username, 2 is the hash tag. + $base = sprintf(_('%1$s tagged %2$s'), $base, $this->tag); } if ($this->page == 1) { return $base; } else { + // TRANS: Extended page title showing tagged notices in one user's stream. Param 1 is the main title clause; 2 is the page number. return sprintf(_('%1$s, page %2$d'), $base, $this->page); diff --git a/classes/Profile.php b/classes/Profile.php index 37d2c571f9..064ba551c4 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -141,11 +141,32 @@ class Profile extends Memcached_DataObject return true; } + /** + * Gets either the full name (if filled) or the nickname. + * + * @return string + */ function getBestName() { return ($this->fullname) ? $this->fullname : $this->nickname; } + /** + * Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone + * if no fullname is provided. + * + * @return string + */ + function getFancyName() + { + if ($this->fullname) { + // TRANS: Full name of a profile or group followed by nickname in parens + return sprintf(_('%1$s (%2$s)'), $this->fullname, $this->nickname); + } else { + return $this->nickname; + } + } + /** * Get the most recent notice posted by this user, if any. * From 6a181bb12837f477dcaa13619024de2f984b7f20 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 2 Nov 2010 14:20:06 -0700 Subject: [PATCH 2/2] Unrolled tagged vs untagged, page 1 vs page N message variants for showstream title. #2668 --- actions/showstream.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/actions/showstream.php b/actions/showstream.php index de66bc415a..dd6c91b004 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -65,17 +65,22 @@ class ShowstreamAction extends ProfileAction { $base = $this->profile->getFancyName(); if (!empty($this->tag)) { - // TRANS: Page title showing tagged notices in one user's stream. Param 1 is the username, 2 is the hash tag. - $base = sprintf(_('%1$s tagged %2$s'), $base, $this->tag); - } - - if ($this->page == 1) { - return $base; + if ($this->page == 1) { + // TRANS: Page title showing tagged notices in one user's stream. Param 1 is the username, 2 is the hash tag. + return sprintf(_('%1$s tagged %2$s'), $base, $this->tag); + } else { + // TRANS: Page title showing tagged notices in one user's stream. Param 1 is the username, 2 is the hash tag, 3 is the page number. + return sprintf(_('%1$s tagged %2$s, page %3$d'), $base, $this->tag, $this->page); + } } else { - // TRANS: Extended page title showing tagged notices in one user's stream. Param 1 is the main title clause; 2 is the page number. - return sprintf(_('%1$s, page %2$d'), - $base, - $this->page); + if ($this->page == 1) { + return $base; + } else { + // TRANS: Extended page title showing tagged notices in one user's stream. Param 1 is the username, param 2 is the page number. + return sprintf(_('%1$s, page %2$d'), + $base, + $this->page); + } } }