From 3bcff2fa86b6c403bb2fd1f19cf94f001c564e2b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 25 Apr 2011 19:12:26 +0200 Subject: [PATCH] Use profile->getBestName() instead of more complex i18n unfriendly construction. Update translator documentation. Number parameters where more than one is used. L10n updates. Update README file to break lines at or just before 80 characters. Remove PHP4-ism "?>" Update indentation. Update whitespace. --- plugins/Mapstraction/MapstractionPlugin.php | 6 +++-- plugins/Mapstraction/usermap.php | 9 +++++--- plugins/Memcache/MemcachePlugin.php | 1 + plugins/Memcached/MemcachedPlugin.php | 2 +- plugins/Meteor/MeteorPlugin.php | 5 +++-- plugins/Meteor/README | 17 ++++++-------- plugins/Minify/MinifyPlugin.php | 1 + plugins/Minify/README | 4 ++-- plugins/Minify/minify.php | 7 ++++-- plugins/Mobile/WAP20Plugin.php | 6 ----- plugins/MobileProfile/MobileProfilePlugin.php | 20 ++++++++++++++--- plugins/ModHelper/ModHelperPlugin.php | 1 + plugins/ModPlus/ModPlusPlugin.php | 4 +++- plugins/ModPlus/remoteprofileaction.php | 22 +++++++++---------- 14 files changed, 62 insertions(+), 43 deletions(-) diff --git a/plugins/Mapstraction/MapstractionPlugin.php b/plugins/Mapstraction/MapstractionPlugin.php index 54eff20540..f51b607309 100644 --- a/plugins/Mapstraction/MapstractionPlugin.php +++ b/plugins/Mapstraction/MapstractionPlugin.php @@ -164,7 +164,7 @@ class MapstractionPlugin extends Plugin ' var user = null; '. (($actionName == 'showstream') ? ' user = scrapeUser(); ' : '') . ' var notices = scrapeNotices(user); ' . - ' var canvas = $("#map_canvas")[0]; ' . + ' var canvas = $("#map_canvas")[0]; ' . ' if (typeof(canvas) != "undefined") { showMapstraction(canvas, notices); } '. '});'); } @@ -184,6 +184,7 @@ class MapstractionPlugin extends Plugin $action->elementStart('div', array('id' => 'entity_map', 'class' => 'section')); + // TRANS: Header for Map widget that displays a map with geodata for notices. $action->element('h2', null, _m('Map')); $action->element('div', array('id' => 'map_canvas', @@ -196,7 +197,7 @@ class MapstractionPlugin extends Plugin $action->element('a', array('href' => $mapUrl), // TRANS: Clickable item to allow opening the map in full size. - _m("Full size")); + _m('Full size')); $action->elementEnd('div'); } @@ -208,6 +209,7 @@ class MapstractionPlugin extends Plugin 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:Mapstraction', 'rawdescription' => + // TRANS: Plugin description. _m('Show maps of users\' and friends\' notices '. 'with Mapstraction.')); return true; diff --git a/plugins/Mapstraction/usermap.php b/plugins/Mapstraction/usermap.php index 54412146ee..99a43e538a 100644 --- a/plugins/Mapstraction/usermap.php +++ b/plugins/Mapstraction/usermap.php @@ -61,11 +61,14 @@ class UsermapAction extends MapAction $base = $this->profile->getFancyName(); if ($this->page == 1) { - // @todo CHECKME: inconsisten with paged variant below. " map" missing. - return $base; + // TRANS: Title for map widget. + // TRANS: %s is a user name. + return sprintf(_m('%s map'),$base); } else { // @todo CHECKME: Is the part ", page %2$d" relevant here? - return sprintf(_m("%s map, page %d"), + // TRANS: Title for map widget. + // TRANS: %1$s is a user name, %2$d is a page nember. + return sprintf(_m("%1$s map, page %2$d"), $base, $this->page); } diff --git a/plugins/Memcache/MemcachePlugin.php b/plugins/Memcache/MemcachePlugin.php index f0c473c313..8462dfc2c6 100644 --- a/plugins/Memcache/MemcachePlugin.php +++ b/plugins/Memcache/MemcachePlugin.php @@ -243,6 +243,7 @@ class MemcachePlugin extends Plugin 'author' => 'Evan Prodromou, Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:Memcache', 'rawdescription' => + // TRANS: Plugin description. _m('Use Memcached to cache query results.')); return true; } diff --git a/plugins/Memcached/MemcachedPlugin.php b/plugins/Memcached/MemcachedPlugin.php index 3b3383d496..56793d0ff6 100644 --- a/plugins/Memcached/MemcachedPlugin.php +++ b/plugins/Memcached/MemcachedPlugin.php @@ -52,7 +52,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class MemcachedPlugin extends Plugin { static $cacheInitialized = false; @@ -215,6 +214,7 @@ class MemcachedPlugin extends Plugin 'author' => 'Evan Prodromou, Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:Memcached', 'rawdescription' => + // TRANS: Plugin description. _m('Use Memcached to cache query results.')); return true; } diff --git a/plugins/Meteor/MeteorPlugin.php b/plugins/Meteor/MeteorPlugin.php index 6e93e364f7..ec44eef17b 100644 --- a/plugins/Meteor/MeteorPlugin.php +++ b/plugins/Meteor/MeteorPlugin.php @@ -112,7 +112,7 @@ class MeteorPlugin extends RealtimePlugin $this->_socket = stream_socket_client("tcp://{$controlserver}:{$this->controlport}", $errno, $errstr, $timeout, $flags); if (!$this->_socket) { // TRANS: Exception. %1$s is the control server, %2$s is the control port. - throw new Exception(sprintf(_m('Couldn\'t connect to %1$s on %2$s.'),$controlserver,$this->controlport)); + throw new Exception(sprintf(_m('Could not connect to %1$s on %2$s.'),$controlserver,$this->controlport)); } } @@ -125,7 +125,7 @@ class MeteorPlugin extends RealtimePlugin $result = fgets($this->_socket); if (preg_match('/^ERR (.*)$/', $result, $matches)) { // TRANS: Exception. %s is the Meteor message that could not be added. - throw new Exception(sprintf(_m('Error adding meteor message "%s"'),$matches[1])); + throw new Exception(sprintf(_m('Error adding meteor message "%s".'),$matches[1])); } // TODO: parse and deal with result } @@ -155,6 +155,7 @@ class MeteorPlugin extends RealtimePlugin 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:Meteor', 'rawdescription' => + // TRANS: Plugin description. _m('Plugin to do "real time" updates using Comet/Bayeux.')); return true; } diff --git a/plugins/Meteor/README b/plugins/Meteor/README index 22f548462f..f21828cdc5 100644 --- a/plugins/Meteor/README +++ b/plugins/Meteor/README @@ -1,27 +1,24 @@ -This is a plugin to automatically load notices in the browser no -matter who creates them -- the kind of thing we see with -search.twitter.com, rejaw.com, or FriendFeed's "real time" news. +This is a plugin to automatically load notices in the browser no matter who +creates them -- the kind of thing we see with search.twitter.com, rejaw.com, or +FriendFeed's "real time" news. It requires a meteor server. http://meteorserver.org/ -Note that the controller interface needs to be accessible by the Web -server, and the subscriber interface needs to be accessible by your -Web users. You MUST firewall the controller interface from users; -otherwise anyone will be able to push any message to your subscribers. -Not good! +Note that the controller interface needs to be accessible by the Web server, and +the subscriber interface needs to be accessible by your Web users. You MUST +firewall the controller interface from users; otherwise anyone will be able to +push any message to your subscribers. Not good! You can enable the plugin with this line in config.php: addPlugin('Meteor', array('webserver' => 'meteor server address')); Available parameters: - * webserver: Web server address. Defaults to site server. * webport: port to connect to for Web access. Defaults to 4670. * controlserver: Control server address. Defaults to webserver. * controlport: port to connect to for control. Defaults to 4671. * channelbase: a base string to use for channels. Good if you have multiple sites using the same meteor server. - diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index cfed0779ba..4041b228ae 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -176,6 +176,7 @@ class MinifyPlugin extends Plugin 'author' => 'Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:Minify', 'rawdescription' => + // TRANS: Plugin description. _m('The Minify plugin minifies StatusNet\'s CSS and JavaScript, removing whitespace and comments.')); return true; } diff --git a/plugins/Minify/README b/plugins/Minify/README index f7763735ed..97fa7dadf9 100644 --- a/plugins/Minify/README +++ b/plugins/Minify/README @@ -1,4 +1,5 @@ -The Minify plugin minifies your CSS and Javascript, removing whitespace and comments. +The Minify plugin minifies your CSS and Javascript, removing whitespace and +comments. Note that if enabled this plugin and use a theme server, (if any of $config['theme']['server'], $config['theme']['path'], @@ -31,4 +32,3 @@ Example ======= addPlugin('minify', array()); - diff --git a/plugins/Minify/minify.php b/plugins/Minify/minify.php index e012a40272..b7bee7c881 100644 --- a/plugins/Minify/minify.php +++ b/plugins/Minify/minify.php @@ -46,16 +46,18 @@ class MinifyAction extends Action if(file_exists($this->file)) { return true; } else { + // TRANS: Client error displayed when not providing a valid path in parameter "f". $this->clientError(_m('The parameter "f" is not a valid path.'),404); return false; } }else{ + // TRANS: Client error displayed when not providing parameter "f". $this->clientError(_m('The parameter "f" is required but missing.'),500); return false; } } - function etag() + function etag() { if(isset($this->v)) { return "\"" . crc32($this->file . $this->v) . "\""; @@ -73,7 +75,7 @@ class MinifyAction extends Action function handle($args) { parent::handle($args); - + $c = Cache::instance(); if (!empty($c)) { $cacheKey = Cache::key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v); @@ -108,6 +110,7 @@ class MinifyAction extends Action header('Content-Type: ' . self::TYPE_CSS); break; default: + // TRANS: Client error displayed when trying to minify an unsupported file type. $this->clientError(_m('File type not supported.'),500); return false; } diff --git a/plugins/Mobile/WAP20Plugin.php b/plugins/Mobile/WAP20Plugin.php index aae48a5200..fc5008cda6 100644 --- a/plugins/Mobile/WAP20Plugin.php +++ b/plugins/Mobile/WAP20Plugin.php @@ -31,7 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } - /** * Superclass for plugin to output XHTML Mobile Profile * @@ -44,13 +43,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { class WAP20Plugin extends Plugin { - function onStartShowHTML($action) { } - } - - -?> diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index fa0c4e7c22..7e005731b6 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -193,6 +193,7 @@ class MobileProfilePlugin extends WAP20Plugin $type = common_negotiate_type($cp, $sp); if (!$type) { + // TRANS: Client exception thrown when requesting a not supported media type. throw new ClientException(_m('This page is not available in a '. 'media type you accept.'), 406); } @@ -310,31 +311,41 @@ class MobileProfilePlugin extends WAP20Plugin $action->elementStart('ul', array('id' => 'site_nav_global_primary')); if ($user) { $action->menuItem(common_local_url('all', array('nickname' => $user->nickname)), + // TRANS: Menu item in mobile profile to go to start page of site. _m('Home')); $action->menuItem(common_local_url('profilesettings'), + // TRANS: Menu item in mobile profile to go to user account settings. _m('Account')); $action->menuItem(common_local_url('oauthconnectionssettings'), - _m('Connect')); + // TRANS: Menu item in mobile profile to connect to other services. + _m('Connect')); if ($user->hasRight(Right::CONFIGURESITE)) { $action->menuItem(common_local_url('siteadminpanel'), - _m('Admin'), _m('Change site configuration'), false, 'nav_admin'); + // TRANS: Menu item in mobile profile to manage site settings. + _m('Admin'), + _m('Change site configuration'), false, 'nav_admin'); } if (common_config('invite', 'enabled')) { $action->menuItem(common_local_url('invite'), + // TRANS: Menu item in mobile profile to invite other people. _m('Invite')); } $action->menuItem(common_local_url('logout'), + // TRANS: Menu item in mobile profile log the current user off. _m('Logout')); } else { if (!common_config('site', 'closed')) { $action->menuItem(common_local_url('register'), + // TRANS: Menu item in mobile profile to register with the site. _m('Register')); } $action->menuItem(common_local_url('login'), + // TRANS: Menu item in mobile profile to log in. _m('Login')); } if ($user || !common_config('site', 'private')) { $action->menuItem(common_local_url('peoplesearch'), + // TRANS: Menu item in mobile profile to search the site. _m('Search')); } $action->elementEnd('ul'); @@ -362,11 +373,13 @@ class MobileProfilePlugin extends WAP20Plugin if (common_config('attachments', 'uploads')) { if ($this->mobileFeatures['inputfiletype']) { $form->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); + // TRANS: Field label in mobile profile to attach a file to a status. $form->out->element('label', array('for' => 'notice_data-attach'), _m('Attach')); $form->out->element('input', array('id' => 'notice_data-attach', 'type' => 'file', 'name' => 'attach', - 'title' => _m('Attach a file'))); + // TRANS: Field title in mobile profile to attach a file to a status. + 'title' => _m('Attach a file.'))); } } if ($form->action) { @@ -448,6 +461,7 @@ class MobileProfilePlugin extends WAP20Plugin 'author' => 'Sarven Capadisli', 'homepage' => 'http://status.net/wiki/Plugin:MobileProfile', 'rawdescription' => + // TRANS: Plugin description. _m('XHTML MobileProfile output for supporting user agents.')); return true; } diff --git a/plugins/ModHelper/ModHelperPlugin.php b/plugins/ModHelper/ModHelperPlugin.php index d003827d13..c2757bbeae 100644 --- a/plugins/ModHelper/ModHelperPlugin.php +++ b/plugins/ModHelper/ModHelperPlugin.php @@ -34,6 +34,7 @@ class ModHelperPlugin extends Plugin 'author' => 'Brion Vibber', 'homepage' => 'http://status.net/wiki/Plugin:ModHelper', 'rawdescription' => + // TRANS: Plugin description. _m('Lets users who have been manually marked as "modhelper"s silence accounts.')); return true; diff --git a/plugins/ModPlus/ModPlusPlugin.php b/plugins/ModPlus/ModPlusPlugin.php index ed478c27b8..95265c52ca 100644 --- a/plugins/ModPlus/ModPlusPlugin.php +++ b/plugins/ModPlus/ModPlusPlugin.php @@ -36,7 +36,8 @@ class ModPlusPlugin extends Plugin 'author' => 'Brion Vibber', 'homepage' => 'http://status.net/wiki/Plugin:ModPlus', 'rawdescription' => - _m('UI extensions for profile moderation actions.')); + // TRANS: Plugin description. + _m('UI extension for profile moderation actions.')); return true; } @@ -136,6 +137,7 @@ class ModPlusPlugin extends Plugin $isRemote = !(User::staticGet('id', $profile->id)); if ($isRemote) { $target = common_local_url('remoteprofile', array('id' => $profile->id)); + // TRANS: Label for access to remote profile options. $label = _m('Remote profile options...'); $out->elementStart('div', 'remote-profile-options'); $out->element('a', array('href' => $target), $label); diff --git a/plugins/ModPlus/remoteprofileaction.php b/plugins/ModPlus/remoteprofileaction.php index 4399c4813c..8e2fcad284 100644 --- a/plugins/ModPlus/remoteprofileaction.php +++ b/plugins/ModPlus/remoteprofileaction.php @@ -1,5 +1,5 @@ profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') '; - } else { - $base = $this->profile->nickname; - } + $base = $this->profile->getBestName(); $host = parse_url($this->profile->profileurl, PHP_URL_HOST); - return sprintf(_m('%s on %s'), $base, $host); + // TRANS: Remote profile action page title. + // TRANS: %1$s is a username, %2$s is a hostname. + return sprintf(_m('%1$s on %2$s'), $base, $host); } /** @@ -60,7 +57,10 @@ class RemoteProfileAction extends ShowstreamAction $url = $this->profile->profileurl; $host = parse_url($url, PHP_URL_HOST); $markdown = sprintf( - _m('This remote profile is registered on another site; see [%s\'s original profile page on %s](%s).'), + // TRANS: Message on remote profile page. + // TRANS: This message contains Markdown links in the form [description](link). + // TRANS: %1$s is a profile nickname, %2$s is a hostname, %3$s is a URL. + _m('This remote profile is registered on another site; see [%1$s\'s original profile page on %2$s](%3$s).'), $this->profile->nickname, $host, $url); @@ -68,6 +68,7 @@ class RemoteProfileAction extends ShowstreamAction $this->raw($html); if ($this->profile->hasRole(Profile_role::SILENCED)) { + // TRANS: Message on blocked remote profile page. $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.'); $this->raw(common_markup_to_html($markdown)); } @@ -103,5 +104,4 @@ class RemoteProfileAction extends ShowstreamAction { // skip } - -} \ No newline at end of file +} -- 2.39.5