Migrate some more code from manually constructing "fullname (nickname)" to using Profile->getFancyName(). Encapsulates common logic and allows for localization of the parens.

This commit is contained in:
Brion Vibber 2010-11-03 13:10:42 -07:00
parent dc4fafbbd1
commit 6e03456753
5 changed files with 5 additions and 23 deletions

View File

@ -79,11 +79,7 @@ class OembedAction extends Action
if (empty($profile)) { if (empty($profile)) {
$this->serverError(_('Notice has no profile.'), 500); $this->serverError(_('Notice has no profile.'), 500);
} }
if (!empty($profile->fullname)) { $authorname = $profile->getFancyName();
$authorname = $profile->fullname . ' (' . $profile->nickname . ')';
} else {
$authorname = $profile->nickname;
}
$oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'),
$authorname, $authorname,
common_exact_date($notice->created)); common_exact_date($notice->created));

View File

@ -167,11 +167,7 @@ class ShownoticeAction extends OwnerDesignAction
function title() function title()
{ {
if (!empty($this->profile->fullname)) { $base = $this->profile->getFancyName();
$base = $this->profile->fullname . ' (' . $this->profile->nickname . ')';
} else {
$base = $this->profile->nickname;
}
return sprintf(_('%1$s\'s status on %2$s'), return sprintf(_('%1$s\'s status on %2$s'),
$base, $base,

View File

@ -306,7 +306,7 @@ class NoticeListItem extends Widget
$attrs = array('href' => $this->profile->profileurl, $attrs = array('href' => $this->profile->profileurl,
'class' => 'url'); 'class' => 'url');
if (!empty($this->profile->fullname)) { if (!empty($this->profile->fullname)) {
$attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; $attrs['title'] = $this->profile->getFancyName();
} }
$this->out->elementStart('a', $attrs); $this->out->elementStart('a', $attrs);
$this->showAvatar(); $this->showAvatar();

View File

@ -61,12 +61,7 @@ class AllmapAction extends MapAction
function title() function title()
{ {
if (!empty($this->profile->fullname)) { $base = $this->profile->getFancyName();
// @todo FIXME: Bad i18n. Should be "%1$s (%2$s)".
$base = $this->profile->fullname . ' (' . $this->user->nickname . ') ';
} else {
$base = $this->user->nickname;
}
if ($this->page == 1) { if ($this->page == 1) {
// TRANS: Page title. // TRANS: Page title.

View File

@ -58,12 +58,7 @@ class UsermapAction extends MapAction
function title() function title()
{ {
if (!empty($this->profile->fullname)) { $base = $this->profile->getFancyName();
// @todo FIXME: Bad i18n. Should be '%1$s (%2$s)'
$base = $this->profile->fullname . ' (' . $this->user->nickname . ')';
} else {
$base = $this->user->nickname;
}
if ($this->page == 1) { if ($this->page == 1) {
// @todo CHECKME: inconsisten with paged variant below. " map" missing. // @todo CHECKME: inconsisten with paged variant below. " map" missing.