We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 5a6f6162 authored by Siebrand Mazeland's avatar Siebrand Mazeland

* i18n/L10n update

* translator comments added
* remove superfluous whitespace
parent 07cd52af
......@@ -223,6 +223,7 @@ class OStatusPlugin extends Plugin
array('nickname' => $profile->nickname));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
// TRANS: Link description for link to subscribe to a remote user.
_m('Subscribe'));
$output->elementEnd('li');
......@@ -241,6 +242,7 @@ class OStatusPlugin extends Plugin
array('group' => $group->nickname));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
// TRANS: Link description for link to join a remote group.
_m('Join'));
}
......@@ -453,6 +455,7 @@ class OStatusPlugin extends Plugin
}
$url = $notice->url;
// TRANSLATE: %s is a domain.
$title = sprintf(_m("Sent from %s via OStatus"), $domain);
return false;
}
......@@ -524,6 +527,7 @@ class OStatusPlugin extends Plugin
}
if (!$oprofile->subscribe()) {
// TRANS: Exception.
throw new Exception(_m('Could not set up remote subscription.'));
}
}
......@@ -563,10 +567,10 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Follow");
$act->title = _m("Follow");
// TRANS: Success message for subscribe to user attempt through OStatus.
// TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name.
$act->content = sprintf(_("%1$s is now following %2$s."),
$act->content = sprintf(_m('%1$s is now following %2$s.'),
$subscriber->getBestName(),
$other->getBestName());
......@@ -613,10 +617,10 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Unfollow");
$act->title = _m('Unfollow');
// TRANS: Success message for unsubscribe from user attempt through OStatus.
// TRANS: %1$s is the unsubscriber's name, %2$s is the unsubscribed user's name.
$act->content = sprintf(_("%1$s stopped following %2$s."),
$act->content = sprintf(_m('%1$s stopped following %2$s.'),
$profile->getBestName(),
$other->getBestName());
......@@ -671,6 +675,7 @@ class OStatusPlugin extends Plugin
return true;
} else {
$oprofile->garbageCollect();
// TRANS: Exception.
throw new Exception(_m("Failed joining remote group."));
}
}
......@@ -729,7 +734,6 @@ class OStatusPlugin extends Plugin
* @param Notice $notice being favored
* @return hook return value
*/
function onEndFavorNotice(Profile $profile, Notice $notice)
{
$user = User::staticGet('id', $profile->id);
......@@ -753,10 +757,10 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Favor");
$act->title = _m('Favor');
// TRANS: Success message for adding a favorite notice through OStatus.
// TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice.
$act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
$act->content = sprintf(_m('%1$s marked notice %2$s as a favorite.'),
$profile->getBestName(),
$notice->uri);
......@@ -799,10 +803,10 @@ class OStatusPlugin extends Plugin
$notice->id,
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Disfavor");
$act->title = _m('Disfavor');
// TRANS: Success message for remove a favorite notice through OStatus.
// TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice.
$act->content = sprintf(_("%1$s marked notice %2$s as no longer a favorite."),
$act->content = sprintf(_m('%1$s marked notice %2$s as no longer a favorite.'),
$profile->getBestName(),
$notice->uri);
......@@ -876,8 +880,9 @@ class OStatusPlugin extends Plugin
$action->elementStart('p', array('id' => 'entity_remote_subscribe',
'class' => 'entity_subscribe'));
$action->element('a', array('href' => common_local_url($target),
'class' => 'entity_remote_subscribe')
, _m('Remote')); // @todo: i18n: Add translator hint for this text.
'class' => 'entity_remote_subscribe'),
// TRANS: Link text for link to remote subscribe.
_m('Remote'));
$action->elementEnd('p');
$action->elementEnd('div');
}
......@@ -916,6 +921,7 @@ class OStatusPlugin extends Plugin
$profile->id,
common_date_iso8601(time()));
$act->time = time();
// TRANS: Title for activity.
$act->title = _m("Profile update");
// TRANS: Ping text for remote profile update through OStatus.
// TRANS: %s is user that updated their profile.
......@@ -948,7 +954,8 @@ class OStatusPlugin extends Plugin
array('nickname' => $profileUser->nickname));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
_m('Subscribe')); // @todo: i18n: Add context.
// TRANS: Link text for a user to subscribe to an OStatus user.
_m('Subscribe'));
$output->elementEnd('li');
}
}
......@@ -962,9 +969,9 @@ class OStatusPlugin extends Plugin
'version' => STATUSNET_VERSION,
'author' => 'Evan Prodromou, James Walker, Brion Vibber, Zach Copley',
'homepage' => 'http://status.net/wiki/Plugin:OStatus',
'rawdescription' =>
_m('Follow people across social networks that implement '.
'<a href="http://ostatus.org/">OStatus</a>.')); // @todo i18n: Add translator hint.
// TRANS: Plugin description.
'rawdescription' => _m('Follow people across social networks that implement '.
'<a href="http://ostatus.org/">OStatus</a>.'));
return true;
}
......
......@@ -17,15 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @package OStatusPlugin
* @author James Walker <james@status.net>
*/
if (!defined('STATUSNET')) {
exit(1);
}
/**
* @package OStatusPlugin
* @author James Walker <james@status.net>
*/
class GroupsalmonAction extends SalmonAction
{
var $group = null;
......@@ -37,17 +36,20 @@ class GroupsalmonAction extends SalmonAction
$id = $this->trimmed('id');
if (!$id) {
$this->clientError(_('No ID.'));
// TRANS: Client error.
$this->clientError(_m('No ID.'));
}
$this->group = User_group::staticGet('id', $id);
if (empty($this->group)) {
$this->clientError(_('No such group.'));
// TRANS: Client error.
$this->clientError(_m('No such group.'));
}
$oprofile = Ostatus_profile::staticGet('group_id', $id);
if ($oprofile) {
// TRANS: Client error.
$this->clientError(_m("Can't accept remote posts for a remote group."));
}
......@@ -57,7 +59,6 @@ class GroupsalmonAction extends SalmonAction
/**
* We've gotten a post event on the Salmon backchannel, probably a reply.
*/
function handlePost()
{
// @fixme process all objects?
......@@ -69,18 +70,20 @@ class GroupsalmonAction extends SalmonAction
case ActivityObject::COMMENT:
break;
default:
// TRANS: Client exception.
throw new ClientException("Can't handle that kind of post.");
}
// Notice must be to the attention of this group
$context = $this->activity->context;
if (empty($context->attention)) {
// TRANS: Client exception.
throw new ClientException("Not to the attention of anyone.");
} else {
$uri = common_local_url('groupbyid', array('id' => $this->group->id));
if (!in_array($uri, $context->attention)) {
// TRANS: Client exception.
throw new ClientException("Not to the attention of this group.");
}
}
......@@ -116,14 +119,15 @@ class GroupsalmonAction extends SalmonAction
* currently we're doing the main logic in joingroup action
* and so have to repeat it here.
*/
function handleJoin()
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
// TRANS: Client error.
$this->clientError(_m("Can't read profile to set up group membership."));
}
if ($oprofile->isGroup()) {
// TRANS: Client error.
$this->clientError(_m("Groups can't join groups."));
}
......@@ -137,7 +141,7 @@ class GroupsalmonAction extends SalmonAction
}
if (Group_block::isBlocked($this->group, $profile)) {
$this->clientError(_('You have been blocked from that group by the admin.'), 403);
$this->clientError(_m('You have been blocked from that group by the admin.'), 403);
return false;
}
......@@ -151,6 +155,7 @@ class GroupsalmonAction extends SalmonAction
//Event::handle('EndJoinGroup', array($this->group, $profile));
//}
} catch (Exception $e) {
// TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
$this->serverError(sprintf(_m('Could not join remote user %1$s to group %2$s.'),
$oprofile->uri, $this->group->nickname));
}
......@@ -159,7 +164,6 @@ class GroupsalmonAction extends SalmonAction
/**
* A remote user left our group.
*/
function handleLeave()
{
$oprofile = $this->ensureProfile();
......@@ -180,10 +184,10 @@ class GroupsalmonAction extends SalmonAction
//Event::handle('EndLeaveGroup', array($this->group, $profile));
//}
} catch (Exception $e) {
// TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
$this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'),
$oprofile->uri, $this->group->nickname));
return;
}
}
}
......@@ -26,7 +26,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class HostMetaAction extends Action
{
function handle()
{
parent::handle();
......
......@@ -72,13 +72,16 @@ class OStatusGroupAction extends OStatusSubAction
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->input('profile',
// TRANS: Field label.
_m('Join group'),
$this->profile_uri,
// TRANS: Tooltip for field label "Join group".
_m("OStatus group's address, like http://example.net/group/nickname."));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('validate', _m('Continue'));
// TRANS: Button text.
$this->submit('validate', _m('BUTTON','Continue'));
$this->elementEnd('fieldset');
......@@ -156,7 +159,6 @@ class OStatusGroupAction extends OStatusSubAction
*
* @return string Title of the page
*/
function title()
{
// TRANS: Page title for OStatus remote group join form
......@@ -168,9 +170,9 @@ class OStatusGroupAction extends OStatusSubAction
*
* @return instructions for use
*/
function getInstructions()
{
// TRANS: Instructions.
return _m('You can subscribe to groups from other supported sites. Paste the group\'s profile URI below:');
}
......
......@@ -27,7 +27,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class OStatusInitAction extends Action
{
var $nickname;
var $group;
var $profile;
......@@ -38,6 +37,7 @@ class OStatusInitAction extends Action
parent::prepare($args);
if (common_logged_in()) {
// TRANS: Client error.
$this->clientError(_m('You can use the local subscription!'));
return false;
}
......@@ -78,6 +78,7 @@ class OStatusInitAction extends Action
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Form title.
$this->element('title', null, _m('Subscribe to user'));
$this->elementEnd('head');
$this->elementStart('body');
......@@ -92,11 +93,15 @@ class OStatusInitAction extends Action
function showContent()
{
if ($this->group) {
// TRANS: Form legend.
$header = sprintf(_m('Join group %s'), $this->group);
$submit = _m('Join');
// TRANS: Button text.
$submit = _m('BUTTON','Join');
} else {
// TRANS: Form legend.
$header = sprintf(_m('Subscribe to %s'), $this->nickname);
$submit = _m('Subscribe');
// TRANS: Button text.
$submit = _m('BUTTON','Subscribe');
}
$this->elementStart('form', array('id' => 'form_ostatus_connect',
'method' => 'post',
......@@ -108,12 +113,15 @@ class OStatusInitAction extends Action
$this->elementStart('ul', 'form_data');
$this->elementStart('li', array('id' => 'ostatus_nickname'));
// TRANS: Field label.
$this->input('nickname', _m('User nickname'), $this->nickname,
_m('Nickname of the user you want to follow.'));
$this->hidden('group', $this->group); // pass-through for magic links
$this->elementEnd('li');
$this->elementStart('li', array('id' => 'ostatus_profile'));
// TRANS: Field label.
$this->input('profile', _m('Profile Account'), $this->profile,
// TRANS: Tooltip for field label "Profile Account".
_m('Your account id (e.g. user@identi.ca).'));
$this->elementEnd('li');
$this->elementEnd('ul');
......@@ -135,6 +143,7 @@ class OStatusInitAction extends Action
} elseif (strpos($this->profile, '@') !== false) {
$this->connectWebfinger($this->profile);
} else {
// TRANS: Client error.
$this->clientError(_m("Must provide a remote profile."));
}
}
......@@ -146,6 +155,7 @@ class OStatusInitAction extends Action
$disco = new Discovery;
$result = $disco->lookup($acct);
if (!$result) {
// TRANS: Client error.
$this->clientError(_m("Couldn't look up OStatus account profile."));
}
......@@ -158,6 +168,7 @@ class OStatusInitAction extends Action
}
}
// TRANS: Client error.
$this->clientError(_m("Couldn't confirm remote profile address."));
}
......@@ -183,6 +194,7 @@ class OStatusInitAction extends Action
if ($user) {
return common_local_url('userbyid', array('id' => $user->id));
} else {
// TRANS: Client error.
$this->clientError("No such user.");
}
} else if ($this->group) {
......@@ -190,16 +202,18 @@ class OStatusInitAction extends Action
if ($group) {
return common_local_url('groupbyid', array('id' => $group->group_id));
} else {
// TRANS: Client error.
$this->clientError("No such group.");
}
} else {
// TRANS: Client error.
$this->clientError("No local user or group nickname provided.");
}
}
function title()
{
// TRANS: Page title.
return _m('OStatus Connect');
}
}
......@@ -62,13 +62,15 @@ class OStatusSubAction extends Action
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->input('profile',
// TRANS: Field label for a field that takes an OStatus user address.
_m('Subscribe to'),
$this->profile_uri,
_m("OStatus user's address, like nickname@example.com or http://example.net/nickname")); // @todo i18n FIXME: needs context/translator hint.
// TRANS: Tooltip for field label "Subscribe to".
_m('OStatus user\'s address, like nickname@example.com or http://example.net/nickname'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('validate', _m('Continue')); // @todo i18n FIXME: needs context/translator hint.
// TRANS: Button text.
$this->submit('validate', _m('BUTTON','Continue'));
$this->elementEnd('fieldset');
......@@ -103,10 +105,14 @@ class OStatusSubAction extends Action
$this->hidden('profile', $this->profile_uri);
if ($this->oprofile->isGroup()) {
$this->submit('submit', _m('Join'), 'submit', null,
_m('Join this group')); // @todo i18n FIXME: needs context/translator hint.
// TRANS: Button text.
// TRANS: Tooltip for button "Join".
_m('BUTTON','Join this group'));
} else {
$this->submit('submit', _m('Confirm'), 'submit', null,
_m('Subscribe to this user')); // @todo i18n FIXME: needs context/translator hint.
// TRANS: Button text.
$this->submit('submit', _m('BUTTON','Confirm'), 'submit', null,
// TRANS: Tooltip for button "Confirm".
_m('Subscribe to this user'));
}
$this->elementEnd('fieldset');
$this->elementEnd('form');
......@@ -156,7 +162,7 @@ class OStatusSubAction extends Action
$this->elementStart('div', 'entity_profile vcard');
$this->elementStart('dl', 'entity_depiction');
$this->element('dt', null, _('Photo'));
$this->element('dt', null, _m('Photo'));
$this->elementStart('dd');
$this->element('img', array('src' => $avatar,
'class' => 'photo avatar',
......@@ -167,7 +173,7 @@ class OStatusSubAction extends Action
$this->elementEnd('dl');
$this->elementStart('dl', 'entity_nickname');
$this->element('dt', null, _('Nickname'));
$this->element('dt', null, _m('Nickname'));
$this->elementStart('dd');
$hasFN = ($fullname !== '') ? 'nickname' : 'fn nickname';
$this->elementStart('a', array('href' => $profile,
......@@ -188,7 +194,7 @@ class OStatusSubAction extends Action
}
if (!is_null($location)) {
$this->elementStart('dl', 'entity_location');
$this->element('dt', null, _('Location'));
$this->element('dt', null, _m('Location'));
$this->elementStart('dd', 'label');
$this->raw($location);
$this->elementEnd('dd');
......@@ -197,7 +203,7 @@ class OStatusSubAction extends Action
if (!is_null($homepage)) {
$this->elementStart('dl', 'entity_url');
$this->element('dt', null, _('URL'));
$this->element('dt', null, _m('URL'));
$this->elementStart('dd');
$this->elementStart('a', array('href' => $homepage,
'class' => 'url'));
......@@ -209,7 +215,7 @@ class OStatusSubAction extends Action
if (!is_null($note)) {
$this->elementStart('dl', 'entity_note');
$this->element('dt', null, _('Note'));
$this->element('dt', null, _m('Note'));
$this->elementStart('dd', 'note');
$this->raw($note);
$this->elementEnd('dd');
......@@ -244,31 +250,39 @@ class OStatusSubAction extends Action
} else if (Validate::uri($this->profile_uri)) {
$this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);
} else {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug('Invalid address format.', __FILE__);
return false;
}
return true;
} catch (FeedSubBadURLException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug('Invalid URL or could not reach server.', __FILE__);
} catch (FeedSubBadResponseException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Cannot read feed; server returned error.', __FILE__);
} catch (FeedSubEmptyException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Cannot read feed; server returned an empty page.', __FILE__);
} catch (FeedSubBadHTMLException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Bad HTML, could not find feed link.', __FILE__);
} catch (FeedSubNoFeedException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Could not find a feed linked from this URL.', __FILE__);
} catch (FeedSubUnrecognizedTypeException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Not a recognized feed type.', __FILE__);
} catch (Exception $e) {
// Any new ones we forgot about
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__);
}
......@@ -350,7 +364,7 @@ class OStatusSubAction extends Action
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. '.
$this->showForm(_m('There was a problem with your session token. '.
'Try again, please.'));
return;
}
......@@ -377,6 +391,7 @@ class OStatusSubAction extends Action
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Form title.
$this->element('title', null, _m('Subscribe to user'));
$this->elementEnd('head');
$this->elementStart('body');
......@@ -408,6 +423,7 @@ class OStatusSubAction extends Action
function getInstructions()
{
// TRANS: Instructions.
return _m('You can subscribe to users from other supported sites. Paste their address or profile URI below:');
}
......@@ -426,7 +442,6 @@ class OStatusSubAction extends Action
*
* @return void
*/
function showContent()
{
if ($this->oprofile) {
......@@ -459,5 +474,4 @@ class OStatusSubAction extends Action
function showNoticeForm() {
// nop
}
}
......@@ -34,7 +34,7 @@ class OwnerxrdAction extends XrdAction
$this->user = User::siteOwner();
if (!$this->user) {
$this->clientError(_('No such user.'), 404);
$this->clientError(_m('No such user.'), 404);
return false;
}
......
......@@ -24,7 +24,6 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class PushCallbackAction extends Action
{
function handle()
......@@ -46,13 +45,13 @@ class PushCallbackAction extends Action
$feedid = $this->arg('feed');
common_log(LOG_INFO, "POST for feed id $feedid");
if (!$feedid) {
throw new ServerException('Empty or invalid feed id.', 400);
throw new ServerException(_m('Empty or invalid feed id.'), 400);
}
$feedsub = FeedSub::staticGet('id', $feedid);
if (!$feedsub) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ServerException('Unknown PuSH feed id ' . $feedid, 400);
// TRANS: Server exception. %s is a feed ID.
throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
}
$hmac = '';
......@@ -84,30 +83,31 @@ class PushCallbackAction extends Action
$verify_token = $this->arg('hub_verify_token');
if ($mode != 'subscribe' && $mode != 'unsubscribe') {
throw new ClientException("Bad hub.mode $mode", 404);
// TRANS: Client exception. %s is an invalid value for hub.mode.
throw new ClientException(sprintf(_m('Bad hub.mode "$s".',$mode)), 404);
}
$feedsub = FeedSub::staticGet('uri', $topic);
if (!$feedsub) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Bad hub.topic feed $topic.", 404);
// TRANS: Client exception. %s is an invalid feed name.
throw new ClientException(sprintf(_m('Bad hub.topic feed "%s".'),$topic), 404);
}
if ($feedsub->verify_token !== $verify_token) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Bad hub.verify_token $token for $topic.", 404);
// TRANS: Client exception. %1$s the invalid token, %2$s is the topic for which the invalid token was given.
throw new ClientException(sprintf(_m('Bad hub.verify_token %1$s for %2$s.'),$token,$topic), 404);
}
if ($mode == 'subscribe') {
// We may get re-sub requests legitimately.
if ($feedsub->sub_state != 'subscribe' && $feedsub->sub_state != 'active') {
// @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unexpected subscribe request for $topic.", 404);
// TRANS: Client exception. %s is an invalid topic.
throw new ClientException(sprintf(_m('Unexpected subscribe request for %s.'),$topic), 404);
}
} else {
if ($feedsub->sub_state != 'unsubscribe') {
// @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unexpected unsubscribe request for $topic.", 404);
// TRANS: Client exception. %s is an invalid topic.