New _m() gettext wrapper with smart detection of plugin domains. Plugin base class registers your gettext files if present at initialization.

update_pot.sh replaced with update_po_templates.php which can do core, plugins, or all (default).
Top-level Makefile added to build .mo files for plugins as well as core.

As described on list:
http://lists.status.net/pipermail/statusnet-dev/2009-December/002869.html
This commit is contained in:
Brion Vibber 2009-12-08 12:17:11 -08:00
parent 3536f01258
commit 4b5e977a7b
43 changed files with 1873 additions and 267 deletions

18
Makefile Normal file
View File

@ -0,0 +1,18 @@
# Warning: do not transform tabs to spaces in this file.
all : translations
core_mo = $(patsubst %.po,%.mo,$(wildcard locale/*/LC_MESSAGES/statusnet.po))
plugin_mo = $(patsubst %.po,%.mo,$(wildcard plugins/*/locale/*/LC_MESSAGES/*.po))
translations : $(core_mo) $(plugin_mo)
clean :
rm -f $(core_mo) $(plugin_mo)
updatepo :
php scripts/update_po_templates.php --all
%.mo : %.po
msgfmt -o $@ $<

View File

@ -36,6 +36,33 @@ if (!function_exists('gettext')) {
require_once("php-gettext/gettext.inc"); require_once("php-gettext/gettext.inc");
} }
if (!function_exists('dpgettext')) {
/**
* Context-aware dgettext wrapper; use when messages in different contexts
* won't be distinguished from the English source but need different translations.
* The context string will appear as msgctxt in the .po files.
*
* Not currently exposed in PHP's gettext module; implemented to be compat
* with gettext.h's macros.
*
* @param string $domain domain identifier, or null for default domain
* @param string $context context identifier, should be some key like "menu|file"
* @param string $msgid English source text
* @return string original or translated message
*/
function dpgettext($domain, $context, $msg)
{
$msgid = $context . "\004" . $msg;
$out = dcgettext($domain, $msgid, LC_MESSAGES);
if ($out == $msgid) {
return $msg;
} else {
return $out;
}
}
}
if (!function_exists('pgettext')) { if (!function_exists('pgettext')) {
/** /**
* Context-aware gettext wrapper; use when messages in different contexts * Context-aware gettext wrapper; use when messages in different contexts
@ -50,9 +77,31 @@ if (!function_exists('pgettext')) {
* @return string original or translated message * @return string original or translated message
*/ */
function pgettext($context, $msg) function pgettext($context, $msg)
{
return dpgettext(textdomain(NULL), $context, $msg);
}
}
if (!function_exists('dnpgettext')) {
/**
* Context-aware dngettext wrapper; use when messages in different contexts
* won't be distinguished from the English source but need different translations.
* The context string will appear as msgctxt in the .po files.
*
* Not currently exposed in PHP's gettext module; implemented to be compat
* with gettext.h's macros.
*
* @param string $domain domain identifier, or null for default domain
* @param string $context context identifier, should be some key like "menu|file"
* @param string $msg singular English source text
* @param string $plural plural English source text
* @param int $n number of items to control plural selection
* @return string original or translated message
*/
function dnpgettext($domain, $context, $msg, $plural, $n)
{ {
$msgid = $context . "\004" . $msg; $msgid = $context . "\004" . $msg;
$out = dcgettext(textdomain(NULL), $msgid, LC_MESSAGES); $out = dcngettext($domain, $msgid, $plural, $n, LC_MESSAGES);
if ($out == $msgid) { if ($out == $msgid) {
return $msg; return $msg;
} else { } else {
@ -78,14 +127,78 @@ if (!function_exists('npgettext')) {
*/ */
function npgettext($context, $msg, $plural, $n) function npgettext($context, $msg, $plural, $n)
{ {
$msgid = $context . "\004" . $msg; return dnpgettext(textdomain(NULL), $msgid, $plural, $n, LC_MESSAGES);
$out = dcngettext(textdomain(NULL), $msgid, $plural, $n, LC_MESSAGES); }
if ($out == $msgid) { }
return $msg;
/**
* Shortcut for *gettext functions with smart domain detection.
*
* If calling from a plugin, this function checks which plugin was
* being called from and uses that as text domain, which will have
* been set up during plugin initialization.
*
* Also handles plurals and contexts depending on what parameters
* are passed to it:
*
* gettext -> _m($msg)
* ngettext -> _m($msg1, $msg2, $n)
* pgettext -> _m($ctx, $msg)
* npgettext -> _m($ctx, $msg1, $msg2, $n)
*
* @fixme may not work properly in eval'd code
*
* @param string $msg
* @return string
*/
function _m($msg/*, ...*/)
{
$domain = _mdomain(debug_backtrace(false));
$args = func_get_args();
switch(count($args)) {
case 1: return dgettext($domain, $msg);
case 2: return dpgettext($domain, $args[0], $args[1]);
case 3: return dngettext($domain, $args[0], $args[1], $args[2]);
case 4: return dnpgettext($domain, $args[0], $args[1], $args[2], $args[3]);
default: throw new Exception("Bad parameter count to _m()");
}
}
/**
* Looks for which plugin we've been called from to set the gettext domain.
*
* @param array $backtrace debug_backtrace() output
* @return string
* @private
* @fixme could explode if SN is under a 'plugins' folder or share name.
*/
function _mdomain($backtrace)
{
/*
0 =>
array
'file' => string '/var/www/mublog/plugins/FeedSub/FeedSubPlugin.php' (length=49)
'line' => int 77
'function' => string '_m' (length=2)
'args' =>
array
0 => &string 'Feeds' (length=5)
*/
static $cached;
$path = $backtrace[0]['file'];
if (!isset($cached[$path])) {
if (DIRECTORY_SEPARATOR !== '/') {
$path = strtr($path, DIRECTORY_SEPARATOR, '/');
}
$cut = strpos($path, '/plugins/') + 9;
$cut2 = strpos($path, '/', $cut);
if ($cut && $cut2) {
$cached[$path] = substr($path, $cut, $cut2 - $cut);
} else { } else {
return $out; return null;
} }
} }
return $cached[$path];
} }

View File

@ -65,6 +65,8 @@ class Plugin
Event::addHandler(mb_substr($method, 2), array($this, $method)); Event::addHandler(mb_substr($method, 2), array($this, $method));
} }
} }
$this->setupGettext();
} }
function initialize() function initialize()
@ -77,6 +79,22 @@ class Plugin
return true; return true;
} }
/**
* Checks if this plugin has localization that needs to be set up.
* Gettext localizations can be called via the _m() helper function.
*/
protected function setupGettext()
{
$class = get_class($this);
if (substr($class, -6) == 'Plugin') {
$name = substr($class, 0, -6);
$path = INSTALLDIR . "/plugins/$name/locale";
if (file_exists($path) && is_dir($path)) {
bindtextdomain($name, $path);
}
}
}
protected function log($level, $msg) protected function log($level, $msg)
{ {
common_log($level, get_class($this) . ': '.$msg); common_log($level, get_class($this) . ': '.$msg);
@ -87,3 +105,4 @@ class Plugin
$this->log(LOG_DEBUG, $msg); $this->log(LOG_DEBUG, $msg);
} }
} }

View File

@ -48,8 +48,8 @@ class FBConnectauthAction extends Action
common_log(LOG_WARNING, 'Facebook Connect Plugin - ' . common_log(LOG_WARNING, 'Facebook Connect Plugin - ' .
"Failed auth attempt, proxy = $proxy, ip = $ip."); "Failed auth attempt, proxy = $proxy, ip = $ip.");
$this->clientError(_('You must be logged into Facebook to ' . $this->clientError(_m('You must be logged into Facebook to ' .
'use Facebook Connect.')); 'use Facebook Connect.'));
} }
return true; return true;
@ -74,7 +74,7 @@ class FBConnectauthAction extends Action
// We don't want these cookies // We don't want these cookies
getFacebook()->clear_cookie_state(); getFacebook()->clear_cookie_state();
$this->clientError(_('There is already a local user linked with this Facebook.')); $this->clientError(_m('There is already a local user linked with this Facebook.'));
} else { } else {
@ -87,12 +87,12 @@ class FBConnectauthAction extends Action
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. Try again, please.')); $this->showForm(_m('There was a problem with your session token. Try again, please.'));
return; return;
} }
if ($this->arg('create')) { if ($this->arg('create')) {
if (!$this->boolean('license')) { if (!$this->boolean('license')) {
$this->showForm(_('You can\'t register if you don\'t agree to the license.'), $this->showForm(_m('You can\'t register if you don\'t agree to the license.'),
$this->trimmed('newname')); $this->trimmed('newname'));
return; return;
} }
@ -102,7 +102,7 @@ class FBConnectauthAction extends Action
} else { } else {
common_debug('Facebook Connect Plugin - ' . common_debug('Facebook Connect Plugin - ' .
print_r($this->args, true)); print_r($this->args, true));
$this->showForm(_('Something weird happened.'), $this->showForm(_m('Something weird happened.'),
$this->trimmed('newname')); $this->trimmed('newname'));
} }
} else { } else {
@ -116,13 +116,13 @@ class FBConnectauthAction extends Action
$this->element('div', array('class' => 'error'), $this->error); $this->element('div', array('class' => 'error'), $this->error);
} else { } else {
$this->element('div', 'instructions', $this->element('div', 'instructions',
sprintf(_('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name'))); sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Facebook to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
} }
} }
function title() function title()
{ {
return _('Facebook Account Setup'); return _m('Facebook Account Setup');
} }
function showForm($error=null, $username=null) function showForm($error=null, $username=null)
@ -150,7 +150,7 @@ class FBConnectauthAction extends Action
'class' => 'form_settings', 'class' => 'form_settings',
'action' => common_local_url('FBConnectAuth'))); 'action' => common_local_url('FBConnectAuth')));
$this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options')); $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
$this->element('legend', null, _('Connection options')); $this->element('legend', null, _m('Connection options'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->element('input', array('type' => 'checkbox', $this->element('input', array('type' => 'checkbox',
@ -159,10 +159,10 @@ class FBConnectauthAction extends Action
'name' => 'license', 'name' => 'license',
'value' => 'true')); 'value' => 'true'));
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license')); $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
$this->text(_('My text and files are available under ')); $this->text(_m('My text and files are available under '));
$this->element('a', array('href' => common_config('license', 'url')), $this->element('a', array('href' => common_config('license', 'url')),
common_config('license', 'title')); common_config('license', 'title'));
$this->text(_(' except this private data: password, email address, IM address, phone number.')); $this->text(_m(' except this private data: password, email address, IM address, phone number.'));
$this->elementEnd('label'); $this->elementEnd('label');
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
@ -170,33 +170,33 @@ class FBConnectauthAction extends Action
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->element('legend', null, $this->element('legend', null,
_('Create new account')); _m('Create new account'));
$this->element('p', null, $this->element('p', null,
_('Create a new user with this nickname.')); _m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('newname', _('New nickname'), $this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '', ($this->username) ? $this->username : '',
_('1-64 lowercase letters or numbers, no punctuation or spaces')); _m('1-64 lowercase letters or numbers, no punctuation or spaces'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('create', _('Create')); $this->submit('create', _m('Create'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->element('legend', null, $this->element('legend', null,
_('Connect existing account')); _m('Connect existing account'));
$this->element('p', null, $this->element('p', null,
_('If you already have an account, login with your username and password to connect it to your Facebook.')); _m('If you already have an account, login with your username and password to connect it to your Facebook.'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('nickname', _('Existing nickname')); $this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->password('password', _('Password')); $this->password('password', _m('Password'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('connect', _('Connect')); $this->submit('connect', _m('Connect'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -212,7 +212,7 @@ class FBConnectauthAction extends Action
function createNewUser() function createNewUser()
{ {
if (common_config('site', 'closed')) { if (common_config('site', 'closed')) {
$this->clientError(_('Registration not allowed.')); $this->clientError(_m('Registration not allowed.'));
return; return;
} }
@ -221,14 +221,14 @@ class FBConnectauthAction extends Action
if (common_config('site', 'inviteonly')) { if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode']; $code = $_SESSION['invitecode'];
if (empty($code)) { if (empty($code)) {
$this->clientError(_('Registration not allowed.')); $this->clientError(_m('Registration not allowed.'));
return; return;
} }
$invite = Invitation::staticGet($code); $invite = Invitation::staticGet($code);
if (empty($invite)) { if (empty($invite)) {
$this->clientError(_('Not a valid invitation code.')); $this->clientError(_m('Not a valid invitation code.'));
return; return;
} }
} }
@ -238,17 +238,17 @@ class FBConnectauthAction extends Action
if (!Validate::string($nickname, array('min_length' => 1, if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64, 'max_length' => 64,
'format' => NICKNAME_FMT))) { 'format' => NICKNAME_FMT))) {
$this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.')); $this->showForm(_m('Nickname must have only lowercase letters and numbers and no spaces.'));
return; return;
} }
if (!User::allowed_nickname($nickname)) { if (!User::allowed_nickname($nickname)) {
$this->showForm(_('Nickname not allowed.')); $this->showForm(_m('Nickname not allowed.'));
return; return;
} }
if (User::staticGet('nickname', $nickname)) { if (User::staticGet('nickname', $nickname)) {
$this->showForm(_('Nickname already in use. Try another one.')); $this->showForm(_m('Nickname already in use. Try another one.'));
return; return;
} }
@ -266,7 +266,7 @@ class FBConnectauthAction extends Action
$result = $this->flinkUser($user->id, $this->fbuid); $result = $this->flinkUser($user->id, $this->fbuid);
if (!$result) { if (!$result) {
$this->serverError(_('Error connecting user to Facebook.')); $this->serverError(_m('Error connecting user to Facebook.'));
return; return;
} }
@ -286,7 +286,7 @@ class FBConnectauthAction extends Action
$password = $this->trimmed('password'); $password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) { if (!common_check_user($nickname, $password)) {
$this->showForm(_('Invalid username or password.')); $this->showForm(_m('Invalid username or password.'));
return; return;
} }
@ -300,7 +300,7 @@ class FBConnectauthAction extends Action
$result = $this->flinkUser($user->id, $this->fbuid); $result = $this->flinkUser($user->id, $this->fbuid);
if (!$result) { if (!$result) {
$this->serverError(_('Error connecting user to Facebook.')); $this->serverError(_m('Error connecting user to Facebook.'));
return; return;
} }
@ -320,7 +320,7 @@ class FBConnectauthAction extends Action
$result = $this->flinkUser($user->id, $this->fbuid); $result = $this->flinkUser($user->id, $this->fbuid);
if (empty($result)) { if (empty($result)) {
$this->serverError(_('Error connecting user to Facebook.')); $this->serverError(_m('Error connecting user to Facebook.'));
return; return;
} }

View File

@ -30,7 +30,7 @@ class FBConnectLoginAction extends Action
parent::handle($args); parent::handle($args);
if (common_is_real_login()) { if (common_is_real_login()) {
$this->clientError(_('Already logged in.')); $this->clientError(_m('Already logged in.'));
} }
$this->showPage(); $this->showPage();
@ -38,7 +38,7 @@ class FBConnectLoginAction extends Action
function getInstructions() function getInstructions()
{ {
return _('Login with your Facebook Account'); return _m('Login with your Facebook Account');
} }
function showPageNotice() function showPageNotice()
@ -52,7 +52,7 @@ class FBConnectLoginAction extends Action
function title() function title()
{ {
return _('Facebook Login'); return _m('Facebook Login');
} }
function showContent() { function showContent() {

View File

@ -53,7 +53,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
function title() function title()
{ {
return _('Facebook Connect Settings'); return _m('Facebook Connect Settings');
} }
/** /**
@ -64,7 +64,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
function getInstructions() function getInstructions()
{ {
return _('Manage how your account connects to Facebook'); return _m('Manage how your account connects to Facebook');
} }
/** /**
@ -89,7 +89,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
if (!$flink) { if (!$flink) {
$this->element('p', 'instructions', $this->element('p', 'instructions',
_('There is no Facebook user connected to this account.')); _m('There is no Facebook user connected to this account.'));
$this->element('fb:login-button', array('onlogin' => 'goto_login()', $this->element('fb:login-button', array('onlogin' => 'goto_login()',
'length' => 'long')); 'length' => 'long'));
@ -97,7 +97,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
} else { } else {
$this->element('p', 'form_note', $this->element('p', 'form_note',
_('Connected Facebook user')); _m('Connected Facebook user'));
$this->elementStart('p', array('class' => 'facebook-user-display')); $this->elementStart('p', array('class' => 'facebook-user-display'));
$this->elementStart('fb:profile-pic', $this->elementStart('fb:profile-pic',
@ -116,18 +116,18 @@ class FBConnectSettingsAction extends ConnectSettingsAction
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->element('legend', null, _('Disconnect my account from Facebook')); $this->element('legend', null, _m('Disconnect my account from Facebook'));
if (!$user->password) { if (!$user->password) {
$this->elementStart('p', array('class' => 'form_guide')); $this->elementStart('p', array('class' => 'form_guide'));
$this->text(_('Disconnecting your Faceboook ' . $this->text(_m('Disconnecting your Faceboook ' .
'would make it impossible to log in! Please ')); 'would make it impossible to log in! Please '));
$this->element('a', $this->element('a',
array('href' => common_local_url('passwordsettings')), array('href' => common_local_url('passwordsettings')),
_('set a password')); _m('set a password'));
$this->text(_(' first.')); $this->text(_m(' first.'));
$this->elementEnd('p'); $this->elementEnd('p');
} else { } else {
@ -139,7 +139,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
$this->element('p', 'instructions', $this->element('p', 'instructions',
sprintf($note, $site, $site)); sprintf($note, $site, $site));
$this->submit('disconnect', _('Disconnect')); $this->submit('disconnect', _m('Disconnect'));
} }
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -161,8 +161,8 @@ class FBConnectSettingsAction extends ConnectSettingsAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_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.')); 'Try again, please.'));
return; return;
} }
@ -175,7 +175,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction
if ($result === false) { if ($result === false) {
common_log_db_error($user, 'DELETE', __FILE__); common_log_db_error($user, 'DELETE', __FILE__);
$this->serverError(_('Couldn\'t delete link to Facebook.')); $this->serverError(_m('Couldn\'t delete link to Facebook.'));
return; return;
} }
@ -191,10 +191,10 @@ class FBConnectSettingsAction extends ConnectSettingsAction
$e->getMessage()); $e->getMessage());
} }
$this->showForm(_('You have disconnected from Facebook.'), true); $this->showForm(_m('You have disconnected from Facebook.'), true);
} else { } else {
$this->showForm(_('Not sure what you\'re trying to do.')); $this->showForm(_m('Not sure what you\'re trying to do.'));
return; return;
} }

View File

@ -406,9 +406,9 @@ class FacebookPlugin extends Plugin
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('FBConnectLogin'), $action->menuItem(common_local_url('FBConnectLogin'),
_('Facebook'), _m('Facebook'),
_('Login or register using Facebook'), _m('Login or register using Facebook'),
'FBConnectLogin' === $action_name); 'FBConnectLogin' === $action_name);
return true; return true;
} }
@ -426,8 +426,8 @@ class FacebookPlugin extends Plugin
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('FBConnectSettings'), $action->menuItem(common_local_url('FBConnectSettings'),
_('Facebook'), _m('Facebook'),
_('Facebook Connect Settings'), _m('Facebook Connect Settings'),
$action_name === 'FBConnectSettings'); $action_name === 'FBConnectSettings');
return true; return true;

View File

@ -168,7 +168,7 @@ class FacebookAction extends Action
$this->elementStart('li', array('class' => $this->elementStart('li', array('class' =>
($this->action == 'facebookhome') ? 'current' : 'facebook_home')); ($this->action == 'facebookhome') ? 'current' : 'facebook_home'));
$this->element('a', $this->element('a',
array('href' => 'index.php', 'title' => _('Home')), _('Home')); array('href' => 'index.php', 'title' => _m('Home')), _m('Home'));
$this->elementEnd('li'); $this->elementEnd('li');
if (common_config('invite', 'enabled')) { if (common_config('invite', 'enabled')) {
@ -176,7 +176,7 @@ class FacebookAction extends Action
array('class' => array('class' =>
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite')); ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
$this->element('a', $this->element('a',
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite')); array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
@ -185,7 +185,7 @@ class FacebookAction extends Action
($this->action == 'facebooksettings') ? 'current' : 'facebook_settings')); ($this->action == 'facebooksettings') ? 'current' : 'facebook_settings'));
$this->element('a', $this->element('a',
array('href' => 'settings.php', array('href' => 'settings.php',
'title' => _('Settings')), _('Settings')); 'title' => _m('Settings')), _m('Settings'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
@ -225,15 +225,15 @@ class FacebookAction extends Action
$this->elementStart('dl', array('class' => 'system_notice')); $this->elementStart('dl', array('class' => 'system_notice'));
$this->element('dt', null, 'Page Notice'); $this->element('dt', null, 'Page Notice');
$loginmsg_part1 = _('To use the %s Facebook Application you need to login ' . $loginmsg_part1 = _m('To use the %s Facebook Application you need to login ' .
'with your username and password. Don\'t have a username yet? '); 'with your username and password. Don\'t have a username yet? ');
$loginmsg_part2 = _(' a new account.'); $loginmsg_part2 = _m(' a new account.');
$this->elementStart('dd'); $this->elementStart('dd');
$this->elementStart('p'); $this->elementStart('p');
$this->text(sprintf($loginmsg_part1, common_config('site', 'name'))); $this->text(sprintf($loginmsg_part1, common_config('site', 'name')));
$this->element('a', $this->element('a',
array('href' => common_local_url('register')), _('Register')); array('href' => common_local_url('register')), _m('Register'));
$this->text($loginmsg_part2); $this->text($loginmsg_part2);
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('dd'); $this->elementEnd('dd');
@ -246,7 +246,7 @@ class FacebookAction extends Action
{ {
$this->elementStart('div', array('id' => 'content')); $this->elementStart('div', array('id' => 'content'));
$this->element('h1', null, _('Login')); $this->element('h1', null, _m('Login'));
if ($msg) { if ($msg) {
$this->element('fb:error', array('message' => $msg)); $this->element('fb:error', array('message' => $msg));
@ -265,20 +265,20 @@ class FacebookAction extends Action
$this->elementStart('ul', array('class' => 'form_datas')); $this->elementStart('ul', array('class' => 'form_datas'));
$this->elementStart('li'); $this->elementStart('li');
$this->input('nickname', _('Nickname')); $this->input('nickname', _m('Nickname'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->password('password', _('Password')); $this->password('password', _m('Password'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('submit', _('Login')); $this->submit('submit', _m('Login'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
$this->elementStart('p'); $this->elementStart('p');
$this->element('a', array('href' => common_local_url('recoverpassword')), $this->element('a', array('href' => common_local_url('recoverpassword')),
_('Lost or forgotten password?')); _m('Lost or forgotten password?'));
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('div'); $this->elementEnd('div');
@ -383,7 +383,7 @@ class FacebookAction extends Action
// Does a little before-after block for next/prev page // Does a little before-after block for next/prev page
if ($have_before || $have_after) { if ($have_before || $have_after) {
$this->elementStart('dl', 'pagination'); $this->elementStart('dl', 'pagination');
$this->element('dt', null, _('Pagination')); $this->element('dt', null, _m('Pagination'));
$this->elementStart('dd', null); $this->elementStart('dd', null);
$this->elementStart('ul', array('class' => 'nav')); $this->elementStart('ul', array('class' => 'nav'));
} }
@ -392,7 +392,7 @@ class FacebookAction extends Action
$newargs = $args ? array_merge($args, $pargs) : $pargs; $newargs = $args ? array_merge($args, $pargs) : $pargs;
$this->elementStart('li', array('class' => 'nav_prev')); $this->elementStart('li', array('class' => 'nav_prev'));
$this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'prev'), $this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'prev'),
_('After')); _m('After'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
if ($have_after) { if ($have_after) {
@ -400,7 +400,7 @@ class FacebookAction extends Action
$newargs = $args ? array_merge($args, $pargs) : $pargs; $newargs = $args ? array_merge($args, $pargs) : $pargs;
$this->elementStart('li', array('class' => 'nav_next')); $this->elementStart('li', array('class' => 'nav_next'));
$this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'next'), $this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'next'),
_('Before')); _m('Before'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
if ($have_before || $have_after) { if ($have_before || $have_after) {
@ -418,13 +418,13 @@ class FacebookAction extends Action
$content = $this->trimmed('status_textarea'); $content = $this->trimmed('status_textarea');
if (!$content) { if (!$content) {
$this->showPage(_('No notice content!')); $this->showPage(_m('No notice content!'));
return; return;
} else { } else {
$content_shortened = common_shorten_links($content); $content_shortened = common_shorten_links($content);
if (Notice::contentTooLong($content_shortened)) { if (Notice::contentTooLong($content_shortened)) {
$this->showPage(sprintf(_('That\'s too long. Max notice size is %d chars.'), $this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'),
Notice::maxContent())); Notice::maxContent()));
return; return;
} }
@ -520,7 +520,7 @@ class FacebookNoticeList extends NoticeList
function show() function show()
{ {
$this->out->elementStart('div', array('id' =>'notices_primary')); $this->out->elementStart('div', array('id' =>'notices_primary'));
$this->out->element('h2', null, _('Notices')); $this->out->element('h2', null, _m('Notices'));
$this->out->elementStart('ul', array('class' => 'notices')); $this->out->elementStart('ul', array('class' => 'notices'));
$cnt = 0; $cnt = 0;

View File

@ -108,7 +108,7 @@ class FacebookhomeAction extends FacebookAction
$user = User::staticGet('nickname', $nickname); $user = User::staticGet('nickname', $nickname);
if (!$user) { if (!$user) {
$this->showLoginForm(_("Server error - couldn't get user!")); $this->showLoginForm(_m("Server error - couldn't get user!"));
} }
$flink = DB_DataObject::factory('foreign_link'); $flink = DB_DataObject::factory('foreign_link');
@ -128,7 +128,7 @@ class FacebookhomeAction extends FacebookAction
return; return;
} else { } else {
$msg = _('Incorrect username or password.'); $msg = _m('Incorrect username or password.');
} }
} }
@ -155,9 +155,9 @@ class FacebookhomeAction extends FacebookAction
function title() function title()
{ {
if ($this->page > 1) { if ($this->page > 1) {
return sprintf(_("%s and friends, page %d"), $this->user->nickname, $this->page); return sprintf(_m("%s and friends, page %d"), $this->user->nickname, $this->page);
} else { } else {
return sprintf(_("%s and friends"), $this->user->nickname); return sprintf(_m("%s and friends"), $this->user->nickname);
} }
} }
@ -186,7 +186,7 @@ class FacebookhomeAction extends FacebookAction
$this->elementStart('div', array('class' => 'facebook_guide')); $this->elementStart('div', array('class' => 'facebook_guide'));
$instructions = sprintf(_('If you would like the %s app to automatically update ' . $instructions = sprintf(_m('If you would like the %s app to automatically update ' .
'your Facebook status with your latest notice, you need ' . 'your Facebook status with your latest notice, you need ' .
'to give it permission.'), $this->app_name); 'to give it permission.'), $this->app_name);
@ -210,13 +210,13 @@ class FacebookhomeAction extends FacebookAction
$this->elementStart('span', array('class' => 'facebook-button')); $this->elementStart('span', array('class' => 'facebook-button'));
$this->element('a', array('href' => $auth_url), $this->element('a', array('href' => $auth_url),
sprintf(_('Okay, do it!'), $this->app_name)); sprintf(_m('Okay, do it!'), $this->app_name));
$this->elementEnd('span'); $this->elementEnd('span');
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li', array('id' => 'fb-permissions-item')); $this->elementStart('li', array('id' => 'fb-permissions-item'));
$this->submit('skip', _('Skip')); $this->submit('skip', _m('Skip'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
@ -245,7 +245,7 @@ class FacebookhomeAction extends FacebookAction
if ($have_before || $have_after) { if ($have_before || $have_after) {
$this->elementStart('dl', 'pagination'); $this->elementStart('dl', 'pagination');
$this->element('dt', null, _('Pagination')); $this->element('dt', null, _m('Pagination'));
$this->elementStart('dd', null); $this->elementStart('dd', null);
$this->elementStart('ul', array('class' => 'nav')); $this->elementStart('ul', array('class' => 'nav'));
} }
@ -254,7 +254,7 @@ class FacebookhomeAction extends FacebookAction
$newargs = $args ? array_merge($args, $pargs) : $pargs; $newargs = $args ? array_merge($args, $pargs) : $pargs;
$this->elementStart('li', array('class' => 'nav_prev')); $this->elementStart('li', array('class' => 'nav_prev'));
$this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'), $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'prev'),
_('After')); _m('After'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
if ($have_after) { if ($have_after) {
@ -262,7 +262,7 @@ class FacebookhomeAction extends FacebookAction
$newargs = $args ? array_merge($args, $pargs) : $pargs; $newargs = $args ? array_merge($args, $pargs) : $pargs;
$this->elementStart('li', array('class' => 'nav_next')); $this->elementStart('li', array('class' => 'nav_next'));
$this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'), $this->element('a', array('href' => "$action?page=$newargs[page]", 'rel' => 'next'),
_('Before')); _m('Before'));
$this->elementEnd('li'); $this->elementEnd('li');
} }
if ($have_before || $have_after) { if ($have_before || $have_after) {

View File

@ -69,9 +69,9 @@ class FacebookinviteAction extends FacebookAction
function showSuccessContent() function showSuccessContent()
{ {
$this->element('h2', null, sprintf(_('Thanks for inviting your friends to use %s'), $this->element('h2', null, sprintf(_m('Thanks for inviting your friends to use %s'),
common_config('site', 'name'))); common_config('site', 'name')));
$this->element('p', null, _('Invitations have been sent to the following users:')); $this->element('p', null, _m('Invitations have been sent to the following users:'));
$friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list? $friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to access the list?
@ -91,7 +91,7 @@ class FacebookinviteAction extends FacebookAction
function showFormContent() function showFormContent()
{ {
$content = sprintf(_('You have been invited to %s'), common_config('site', 'name')) . $content = sprintf(_m('You have been invited to %s'), common_config('site', 'name')) .
htmlentities('<fb:req-choice url="' . $this->app_uri . '" label="Add"/>'); htmlentities('<fb:req-choice url="' . $this->app_uri . '" label="Add"/>');
$this->elementStart('fb:request-form', array('action' => 'invite.php', $this->elementStart('fb:request-form', array('action' => 'invite.php',
@ -100,7 +100,7 @@ class FacebookinviteAction extends FacebookAction
'type' => common_config('site', 'name'), 'type' => common_config('site', 'name'),
'content' => $content)); 'content' => $content));
$this->hidden('invite', 'true'); $this->hidden('invite', 'true');
$actiontext = sprintf(_('Invite your friends to use %s'), common_config('site', 'name')); $actiontext = sprintf(_m('Invite your friends to use %s'), common_config('site', 'name'));
$multi_params = array('showborder' => 'false'); $multi_params = array('showborder' => 'false');
$multi_params['actiontext'] = $actiontext; $multi_params['actiontext'] = $actiontext;
@ -122,7 +122,7 @@ class FacebookinviteAction extends FacebookAction
if ($exclude_ids) { if ($exclude_ids) {
$this->element('h2', null, sprintf(_('Friends already using %s:'), $this->element('h2', null, sprintf(_m('Friends already using %s:'),
common_config('site', 'name'))); common_config('site', 'name')));
$this->elementStart('ul', array('id' => 'facebook-friends')); $this->elementStart('ul', array('id' => 'facebook-friends'));
@ -140,7 +140,7 @@ class FacebookinviteAction extends FacebookAction
function title() function title()
{ {
return sprintf(_('Send invitations')); return sprintf(_m('Send invitations'));
} }
} }

View File

@ -88,7 +88,7 @@ class FacebookinviteAction extends FacebookAction
function title() function title()
{ {
return sprintf(_('Login')); return sprintf(_m('Login'));
} }
function redirectHome() function redirectHome()

View File

@ -55,7 +55,7 @@ class FacebookremoveAction extends FacebookAction
if (!$result) { if (!$result) {
common_log_db_error($flink, 'DELETE', __FILE__); common_log_db_error($flink, 'DELETE', __FILE__);
$this->serverError(_('Couldn\'t remove Facebook user.')); $this->serverError(_m('Couldn\'t remove Facebook user.'));
return; return;
} }

View File

@ -71,9 +71,9 @@ class FacebooksettingsAction extends FacebookAction
$trimmed); $trimmed);
if ($result === false) { if ($result === false) {
$this->showForm(_('There was a problem saving your sync preferences!')); $this->showForm(_m('There was a problem saving your sync preferences!'));
} else { } else {
$this->showForm(_('Sync preferences saved.'), true); $this->showForm(_m('Sync preferences saved.'), true);
} }
} }
@ -96,14 +96,14 @@ class FacebooksettingsAction extends FacebookAction
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'), $this->checkbox('noticesync', _m('Automatically update my Facebook status with my notices.'),
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true); ($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('replysync', _('Send "@" replies to Facebook.'), $this->checkbox('replysync', _m('Send "@" replies to Facebook.'),
($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true); ($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
$this->elementEnd('li'); $this->elementEnd('li');
@ -112,15 +112,15 @@ class FacebooksettingsAction extends FacebookAction
$prefix = trim($this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX)); $prefix = trim($this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX));
$this->input('prefix', _('Prefix'), $this->input('prefix', _m('Prefix'),
($prefix) ? $prefix : null, ($prefix) ? $prefix : null,
_('A string to prefix notices with.')); _m('A string to prefix notices with.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->submit('save', _('Save')); $this->submit('save', _m('Save'));
$this->elementEnd('li'); $this->elementEnd('li');
@ -130,7 +130,7 @@ class FacebooksettingsAction extends FacebookAction
} else { } else {
$instructions = sprintf(_('If you would like %s to automatically update ' . $instructions = sprintf(_m('If you would like %s to automatically update ' .
'your Facebook status with your latest notice, you need ' . 'your Facebook status with your latest notice, you need ' .
'to give it permission.'), $this->app_name); 'to give it permission.'), $this->app_name);
@ -143,7 +143,7 @@ class FacebooksettingsAction extends FacebookAction
$this->elementStart('fb:prompt-permission', array('perms' => 'publish_stream', $this->elementStart('fb:prompt-permission', array('perms' => 'publish_stream',
'next_fbjs' => 'document.setLocation(\'' . "$this->app_uri/settings.php" . '\')')); 'next_fbjs' => 'document.setLocation(\'' . "$this->app_uri/settings.php" . '\')'));
$this->element('span', array('class' => 'facebook-button'), $this->element('span', array('class' => 'facebook-button'),
sprintf(_('Allow %s to update my Facebook status'), common_config('site', 'name'))); sprintf(_m('Allow %s to update my Facebook status'), common_config('site', 'name')));
$this->elementEnd('fb:prompt-permission'); $this->elementEnd('fb:prompt-permission');
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
@ -153,7 +153,7 @@ class FacebooksettingsAction extends FacebookAction
function title() function title()
{ {
return _('Sync preferences'); return _m('Sync preferences');
} }
} }

View File

@ -277,10 +277,10 @@ function mail_facebook_app_removed($user)
$site_name = common_config('site', 'name'); $site_name = common_config('site', 'name');
$subject = sprintf( $subject = sprintf(
_('Your %1$s Facebook application access has been disabled.', _m('Your %1$s Facebook application access has been disabled.',
$site_name)); $site_name));
$body = sprintf(_("Hi, %1\$s. We're sorry to inform you that we are " . $body = sprintf(_m("Hi, %1\$s. We're sorry to inform you that we are " .
'unable to update your Facebook status from %2$s, and have disabled ' . 'unable to update your Facebook status from %2$s, and have disabled ' .
'the Facebook application for your account. This may be because ' . 'the Facebook application for your account. This may be because ' .
'you have removed the Facebook application\'s authorization, or ' . 'you have removed the Facebook application\'s authorization, or ' .

View File

@ -0,0 +1,394 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 20:38-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: facebookaction.php:171
msgid "Home"
msgstr ""
#: facebookaction.php:179
msgid "Invite"
msgstr ""
#: facebookaction.php:188
msgid "Settings"
msgstr ""
#: facebookaction.php:228
#, php-format
msgid ""
"To use the %s Facebook Application you need to login with your username and "
"password. Don't have a username yet? "
msgstr ""
#: facebookaction.php:230
msgid " a new account."
msgstr ""
#: facebookaction.php:236
msgid "Register"
msgstr ""
#: facebookaction.php:249 facebookaction.php:275 facebooklogin.php:91
msgid "Login"
msgstr ""
#: facebookaction.php:268
msgid "Nickname"
msgstr ""
#: facebookaction.php:271 FBConnectAuth.php:196
msgid "Password"
msgstr ""
#: facebookaction.php:281
msgid "Lost or forgotten password?"
msgstr ""
#: facebookaction.php:386 facebookhome.php:248
msgid "Pagination"
msgstr ""
#: facebookaction.php:395 facebookhome.php:257
msgid "After"
msgstr ""
#: facebookaction.php:403 facebookhome.php:265
msgid "Before"
msgstr ""
#: facebookaction.php:421
msgid "No notice content!"
msgstr ""
#: facebookaction.php:427
#, php-format
msgid "That's too long. Max notice size is %d chars."
msgstr ""
#: facebookaction.php:523
msgid "Notices"
msgstr ""
#: facebookutil.php:280
#, php-format
msgid "Your %1$s Facebook application access has been disabled."
msgstr ""
#: facebookutil.php:283
#, php-format
msgid ""
"Hi, %1$s. We're sorry to inform you that we are unable to update your "
"Facebook status from %2$s, and have disabled the Facebook application for "
"your account. This may be because you have removed the Facebook "
"application's authorization, or have deleted your Facebook account. You can "
"re-enable the Facebook application and automatic status updating by re-"
"installing the %2$s Facebook application.\n"
"\n"
"Regards,\n"
"\n"
"%2$s"
msgstr ""
#: FBConnectLogin.php:33
msgid "Already logged in."
msgstr ""
#: FBConnectLogin.php:41
msgid "Login with your Facebook Account"
msgstr ""
#: FBConnectLogin.php:55
msgid "Facebook Login"
msgstr ""
#: facebookhome.php:111
msgid "Server error - couldn't get user!"
msgstr ""
#: facebookhome.php:131
msgid "Incorrect username or password."
msgstr ""
#: facebookhome.php:158
#, php-format
msgid "%s and friends, page %d"
msgstr ""
#: facebookhome.php:160
#, php-format
msgid "%s and friends"
msgstr ""
#: facebookhome.php:189
#, php-format
msgid ""
"If you would like the %s app to automatically update your Facebook status "
"with your latest notice, you need to give it permission."
msgstr ""
#: facebookhome.php:213
msgid "Okay, do it!"
msgstr ""
#: facebookhome.php:219
msgid "Skip"
msgstr ""
#: facebooksettings.php:74
msgid "There was a problem saving your sync preferences!"
msgstr ""
#: facebooksettings.php:76
msgid "Sync preferences saved."
msgstr ""
#: facebooksettings.php:99
msgid "Automatically update my Facebook status with my notices."
msgstr ""
#: facebooksettings.php:106
msgid "Send \"@\" replies to Facebook."
msgstr ""
#: facebooksettings.php:115
msgid "Prefix"
msgstr ""
#: facebooksettings.php:117
msgid "A string to prefix notices with."
msgstr ""
#: facebooksettings.php:123
msgid "Save"
msgstr ""
#: facebooksettings.php:133
#, php-format
msgid ""
"If you would like %s to automatically update your Facebook status with your "
"latest notice, you need to give it permission."
msgstr ""
#: facebooksettings.php:146
#, php-format
msgid "Allow %s to update my Facebook status"
msgstr ""
#: facebooksettings.php:156
msgid "Sync preferences"
msgstr ""
#: facebookinvite.php:72
#, php-format
msgid "Thanks for inviting your friends to use %s"
msgstr ""
#: facebookinvite.php:74
msgid "Invitations have been sent to the following users:"
msgstr ""
#: facebookinvite.php:94
#, php-format
msgid "You have been invited to %s"
msgstr ""
#: facebookinvite.php:103
#, php-format
msgid "Invite your friends to use %s"
msgstr ""
#: facebookinvite.php:125
#, php-format
msgid "Friends already using %s:"
msgstr ""
#: facebookinvite.php:143
msgid "Send invitations"
msgstr ""
#: facebookremove.php:58
msgid "Couldn't remove Facebook user."
msgstr ""
#: FBConnectSettings.php:56 FacebookPlugin.php:430
msgid "Facebook Connect Settings"
msgstr ""
#: FBConnectSettings.php:67
msgid "Manage how your account connects to Facebook"
msgstr ""
#: FBConnectSettings.php:92
msgid "There is no Facebook user connected to this account."
msgstr ""
#: FBConnectSettings.php:100
msgid "Connected Facebook user"
msgstr ""
#: FBConnectSettings.php:119
msgid "Disconnect my account from Facebook"
msgstr ""
#: FBConnectSettings.php:124
msgid ""
"Disconnecting your Faceboook would make it impossible to log in! Please "
msgstr ""
#: FBConnectSettings.php:128
msgid "set a password"
msgstr ""
#: FBConnectSettings.php:130
msgid " first."
msgstr ""
#: FBConnectSettings.php:142
msgid "Disconnect"
msgstr ""
#: FBConnectSettings.php:164 FBConnectAuth.php:90
msgid "There was a problem with your session token. Try again, please."
msgstr ""
#: FBConnectSettings.php:178
msgid "Couldn't delete link to Facebook."
msgstr ""
#: FBConnectSettings.php:194
msgid "You have disconnected from Facebook."
msgstr ""
#: FBConnectSettings.php:197
msgid "Not sure what you're trying to do."
msgstr ""
#: FBConnectAuth.php:51
msgid "You must be logged into Facebook to use Facebook Connect."
msgstr ""
#: FBConnectAuth.php:77
msgid "There is already a local user linked with this Facebook."
msgstr ""
#: FBConnectAuth.php:95
msgid "You can't register if you don't agree to the license."
msgstr ""
#: FBConnectAuth.php:105
msgid "Something weird happened."
msgstr ""
#: FBConnectAuth.php:119
#, php-format
msgid ""
"This is the first time you've logged into %s so we must connect your "
"Facebook to a local account. You can either create a new account, or connect "
"with your existing account, if you have one."
msgstr ""
#: FBConnectAuth.php:125
msgid "Facebook Account Setup"
msgstr ""
#: FBConnectAuth.php:153
msgid "Connection options"
msgstr ""
#: FBConnectAuth.php:162
msgid "My text and files are available under "
msgstr ""
#: FBConnectAuth.php:165
msgid ""
" except this private data: password, email address, IM address, phone number."
msgstr ""
#: FBConnectAuth.php:173
msgid "Create new account"
msgstr ""
#: FBConnectAuth.php:175
msgid "Create a new user with this nickname."
msgstr ""
#: FBConnectAuth.php:178
msgid "New nickname"
msgstr ""
#: FBConnectAuth.php:180
msgid "1-64 lowercase letters or numbers, no punctuation or spaces"
msgstr ""
#: FBConnectAuth.php:183
msgid "Create"
msgstr ""
#: FBConnectAuth.php:188
msgid "Connect existing account"
msgstr ""
#: FBConnectAuth.php:190
msgid ""
"If you already have an account, login with your username and password to "
"connect it to your Facebook."
msgstr ""
#: FBConnectAuth.php:193
msgid "Existing nickname"
msgstr ""
#: FBConnectAuth.php:199
msgid "Connect"
msgstr ""
#: FBConnectAuth.php:215 FBConnectAuth.php:224
msgid "Registration not allowed."
msgstr ""
#: FBConnectAuth.php:231
msgid "Not a valid invitation code."
msgstr ""
#: FBConnectAuth.php:241
msgid "Nickname must have only lowercase letters and numbers and no spaces."
msgstr ""
#: FBConnectAuth.php:246
msgid "Nickname not allowed."
msgstr ""
#: FBConnectAuth.php:251
msgid "Nickname already in use. Try another one."
msgstr ""
#: FBConnectAuth.php:269 FBConnectAuth.php:303 FBConnectAuth.php:323
msgid "Error connecting user to Facebook."
msgstr ""
#: FBConnectAuth.php:289
msgid "Invalid username or password."
msgstr ""
#: FacebookPlugin.php:409 FacebookPlugin.php:429
msgid "Facebook"
msgstr ""
#: FacebookPlugin.php:410
msgid "Login or register using Facebook"
msgstr ""

View File

@ -51,7 +51,6 @@ class FeedSubPlugin extends Plugin
* @param Net_URL_Mapper $m path-to-action mapper * @param Net_URL_Mapper $m path-to-action mapper
* @return boolean hook return * @return boolean hook return
*/ */
function onRouterInitialized($m) function onRouterInitialized($m)
{ {
$m->connect('feedsub/callback/:feed', $m->connect('feedsub/callback/:feed',
@ -74,8 +73,8 @@ class FeedSubPlugin extends Plugin
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('feedsubsettings'), $action->menuItem(common_local_url('feedsubsettings'),
dgettext('FeebSubPlugin', 'Feeds'), _m('Feeds'),
dgettext('FeedSubPlugin', 'Feed subscription options'), _m('Feed subscription options'),
$action_name === 'feedsubsettings'); $action_name === 'feedsubsettings');
return true; return true;

View File

@ -38,7 +38,7 @@ class FeedSubSettingsAction extends ConnectSettingsAction
function title() function title()
{ {
return dgettext('FeedSubPlugin', 'Feed subscriptions'); return _m('Feed subscriptions');
} }
/** /**
@ -49,9 +49,8 @@ class FeedSubSettingsAction extends ConnectSettingsAction
function getInstructions() function getInstructions()
{ {
return dgettext('FeedSubPlugin', return _m('You can subscribe to feeds from other sites; ' .
'You can subscribe to feeds from other sites; ' . 'updates will appear in your personal timeline.');
'updates will appear in your personal timeline.');
} }
/** /**
@ -94,9 +93,9 @@ class FeedSubSettingsAction extends ConnectSettingsAction
$this->elementEnd('ul'); $this->elementEnd('ul');
if ($this->preview) { if ($this->preview) {
$this->submit('subscribe', dgettext('FeedSubPlugin', 'Subscribe')); $this->submit('subscribe', _m('Subscribe'));
} else { } else {
$this->submit('validate', dgettext('FeedSubPlugin', 'Continue')); $this->submit('validate', _m('Continue'));
} }
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -149,8 +148,7 @@ class FeedSubSettingsAction extends ConnectSettingsAction
$feedurl = trim($this->arg('feedurl')); $feedurl = trim($this->arg('feedurl'));
if ($feedurl == '') { if ($feedurl == '') {
$this->showForm(dgettext('FeedSubPlugin', $this->showForm(_m('Empty feed URL!'));
'Empty feed URL!'));
return; return;
} }
$this->feedurl = $feedurl; $this->feedurl = $feedurl;
@ -160,26 +158,26 @@ class FeedSubSettingsAction extends ConnectSettingsAction
$discover = new FeedDiscovery(); $discover = new FeedDiscovery();
$uri = $discover->discoverFromURL($feedurl); $uri = $discover->discoverFromURL($feedurl);
} catch (FeedSubBadURLException $e) { } catch (FeedSubBadURLException $e) {
$this->showForm(dgettext('FeedSubPlugin', 'Invalid URL or could not reach server.')); $this->showForm(_m('Invalid URL or could not reach server.'));
return false; return false;
} catch (FeedSubBadResponseException $e) { } catch (FeedSubBadResponseException $e) {
$this->showForm(dgettext('FeedSubPlugin', 'Cannot read feed; server returned error.')); $this->showForm(_m('Cannot read feed; server returned error.'));
return false; return false;
} catch (FeedSubEmptyException $e) { } catch (FeedSubEmptyException $e) {
$this->showForm(dgettext('FeedSubPlugin', 'Cannot read feed; server returned an empty page.')); $this->showForm(_m('Cannot read feed; server returned an empty page.'));
return false; return false;
} catch (FeedSubBadHTMLException $e) { } catch (FeedSubBadHTMLException $e) {
$this->showForm(dgettext('FeedSubPlugin', 'Bad HTML, could not find feed link.')); $this->showForm(_m('Bad HTML, could not find feed link.'));
return false; return false;
} catch (FeedSubNoFeedException $e) { } catch (FeedSubNoFeedException $e) {
$this->showForm(dgettext('FeedSubPlugin', 'Could not find a feed linked from this URL.')); $this->showForm(_m('Could not find a feed linked from this URL.'));
return false; return false;
} catch (FeedSubUnrecognizedTypeException $e) { } catch (FeedSubUnrecognizedTypeException $e) {
$this->showForm(dgettext('FeedSubPlugin', 'Not a recognized feed type.')); $this->showForm(_m('Not a recognized feed type.'));
return false; return false;
} catch (FeedSubException $e) { } catch (FeedSubException $e) {
// Any new ones we forgot about // Any new ones we forgot about
$this->showForm(dgettext('FeedSubPlugin', 'Bad feed URL.')); $this->showForm(_m('Bad feed URL.'));
return false; return false;
} }
@ -187,7 +185,7 @@ class FeedSubSettingsAction extends ConnectSettingsAction
$this->feedinfo = $this->munger->feedInfo(); $this->feedinfo = $this->munger->feedInfo();
if ($this->feedinfo->huburi == '') { if ($this->feedinfo->huburi == '') {
$this->showForm(dgettext('FeedSubPlugin', 'Feed is not PuSH-enabled; cannot subscribe.')); $this->showForm(_m('Feed is not PuSH-enabled; cannot subscribe.'));
return false; return false;
} }
@ -207,7 +205,7 @@ class FeedSubSettingsAction extends ConnectSettingsAction
$ok = $this->feedinfo->subscribe(); $ok = $this->feedinfo->subscribe();
common_log(LOG_INFO, __METHOD__ . ": sub was $ok"); common_log(LOG_INFO, __METHOD__ . ": sub was $ok");
if (!$ok) { if (!$ok) {
$this->showForm(dgettext('FeedSubPlugin', 'Feed subscription failed! Bad response from hub.')); $this->showForm(_m('Feed subscription failed! Bad response from hub.'));
return; return;
} }
} }
@ -217,11 +215,11 @@ class FeedSubSettingsAction extends ConnectSettingsAction
$profile = $this->feedinfo->getProfile(); $profile = $this->feedinfo->getProfile();
if ($user->isSubscribed($profile)) { if ($user->isSubscribed($profile)) {
$this->showForm(dgettext('FeedSubPlugin', 'Already subscribed!')); $this->showForm(_m('Already subscribed!'));
} elseif ($user->subscribeTo($profile)) { } elseif ($user->subscribeTo($profile)) {
$this->showForm(dgettext('FeedSubPlugin', 'Feed subscribed!')); $this->showForm(_m('Feed subscribed!'));
} else { } else {
$this->showForm(dgettext('FeedSubPlugin', 'Feed subscription failed!')); $this->showForm(_m('Feed subscription failed!'));
} }
} }
} }
@ -230,7 +228,7 @@ class FeedSubSettingsAction extends ConnectSettingsAction
{ {
if ($this->validateFeed()) { if ($this->validateFeed()) {
$this->preview = true; $this->preview = true;
$this->showForm(dgettext('FeedSubPlugin', 'Previewing feed:')); $this->showForm(_m('Previewing feed:'));
} }
} }

View File

@ -212,7 +212,7 @@ class FeedMunger
// try adding #hashtags from the categories/tags on a post. // try adding #hashtags from the categories/tags on a post.
// @todo Should we force a language here? // @todo Should we force a language here?
$format = dgettext("FeedSubPlugin", 'New post: "%1$s" %2$s'); $format = _m('New post: "%1$s" %2$s');
$title = $entry->title; $title = $entry->title;
$link = $this->getAltLink($entry); $link = $this->getAltLink($entry);
$out = sprintf($format, $title, $link); $out = sprintf($format, $title, $link);

View File

@ -0,0 +1,104 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 20:38-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: tests/gettext-speedtest.php:57 FeedSubPlugin.php:76
msgid "Feeds"
msgstr ""
#: FeedSubPlugin.php:77
msgid "Feed subscription options"
msgstr ""
#: feedmunger.php:215
#, php-format
msgid "New post: \"%1$s\" %2$s"
msgstr ""
#: actions/feedsubsettings.php:41
msgid "Feed subscriptions"
msgstr ""
#: actions/feedsubsettings.php:52
msgid ""
"You can subscribe to feeds from other sites; updates will appear in your "
"personal timeline."
msgstr ""
#: actions/feedsubsettings.php:96
msgid "Subscribe"
msgstr ""
#: actions/feedsubsettings.php:98
msgid "Continue"
msgstr ""
#: actions/feedsubsettings.php:151
msgid "Empty feed URL!"
msgstr ""
#: actions/feedsubsettings.php:161
msgid "Invalid URL or could not reach server."
msgstr ""
#: actions/feedsubsettings.php:164
msgid "Cannot read feed; server returned error."
msgstr ""
#: actions/feedsubsettings.php:167
msgid "Cannot read feed; server returned an empty page."
msgstr ""
#: actions/feedsubsettings.php:170
msgid "Bad HTML, could not find feed link."
msgstr ""
#: actions/feedsubsettings.php:173
msgid "Could not find a feed linked from this URL."
msgstr ""
#: actions/feedsubsettings.php:176
msgid "Not a recognized feed type."
msgstr ""
#: actions/feedsubsettings.php:180
msgid "Bad feed URL."
msgstr ""
#: actions/feedsubsettings.php:188
msgid "Feed is not PuSH-enabled; cannot subscribe."
msgstr ""
#: actions/feedsubsettings.php:208
msgid "Feed subscription failed! Bad response from hub."
msgstr ""
#: actions/feedsubsettings.php:218
msgid "Already subscribed!"
msgstr ""
#: actions/feedsubsettings.php:220
msgid "Feed subscribed!"
msgstr ""
#: actions/feedsubsettings.php:222
msgid "Feed subscription failed!"
msgstr ""
#: actions/feedsubsettings.php:231
msgid "Previewing feed:"
msgstr ""

View File

@ -0,0 +1,106 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 14:14-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: FeedSubPlugin.php:77
msgid "Feeds"
msgstr "Flux"
#: FeedSubPlugin.php:78
msgid "Feed subscription options"
msgstr "Préférences pour abonnement flux"
#: feedmunger.php:215
#, php-format
msgid "New post: \"%1$s\" %2$s"
msgstr "Nouveau: \"%1$s\" %2$s"
#: actions/feedsubsettings.php:41
msgid "Feed subscriptions"
msgstr "Abonnements aux fluxes"
#: actions/feedsubsettings.php:52
msgid ""
"You can subscribe to feeds from other sites; updates will appear in your "
"personal timeline."
msgstr ""
"Abonner aux fluxes RSS ou Atom des autres sites web; les temps se trouverair"
"en votre flux personnel."
#: actions/feedsubsettings.php:96
msgid "Subscribe"
msgstr "Abonner"
#: actions/feedsubsettings.php:98
msgid "Continue"
msgstr "Prochaine"
#: actions/feedsubsettings.php:151
msgid "Empty feed URL!"
msgstr ""
#: actions/feedsubsettings.php:161
msgid "Invalid URL or could not reach server."
msgstr ""
#: actions/feedsubsettings.php:164
msgid "Cannot read feed; server returned error."
msgstr ""
#: actions/feedsubsettings.php:167
msgid "Cannot read feed; server returned an empty page."
msgstr ""
#: actions/feedsubsettings.php:170
msgid "Bad HTML, could not find feed link."
msgstr ""
#: actions/feedsubsettings.php:173
msgid "Could not find a feed linked from this URL."
msgstr ""
#: actions/feedsubsettings.php:176
msgid "Not a recognized feed type."
msgstr ""
#: actions/feedsubsettings.php:180
msgid "Bad feed URL."
msgstr ""
#: actions/feedsubsettings.php:188
msgid "Feed is not PuSH-enabled; cannot subscribe."
msgstr ""
#: actions/feedsubsettings.php:208
msgid "Feed subscription failed! Bad response from hub."
msgstr ""
#: actions/feedsubsettings.php:218
msgid "Already subscribed!"
msgstr ""
#: actions/feedsubsettings.php:220
msgid "Feed subscribed!"
msgstr ""
#: actions/feedsubsettings.php:222
msgid "Feed subscription failed!"
msgstr ""
#: actions/feedsubsettings.php:231
msgid "Previewing feed:"
msgstr ""

View File

@ -0,0 +1,78 @@
<?php
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
print "This script must be run from the command line\n";
exit();
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('STATUSNET', true);
define('LACONICA', true);
require_once INSTALLDIR . '/scripts/commandline.inc';
require_once INSTALLDIR . '/extlib/php-gettext/gettext.inc';
common_init_locale("en_US");
common_init_locale('fr');
putenv("LANG=fr");
putenv("LANGUAGE=fr");
setlocale('fr.utf8');
_setlocale('fr.utf8');
_bindtextdomain("statusnet", INSTALLDIR . '/locale');
_bindtextdomain("FeedSub", INSTALLDIR . '/plugins/FeedSub/locale');
$times = 10000;
$delta = array();
$start = microtime(true);
for($i = 0; $i < $times; $i++) {
$result = _("Send");
}
$delta["_"] = array((microtime(true) - $start) / $times, $result);
$start = microtime(true);
for($i = 0; $i < $times; $i++) {
$result = __("Send");
}
$delta["__"] = array((microtime(true) - $start) / $times, $result);
$start = microtime(true);
for($i = 0; $i < $times; $i++) {
$result = dgettext("FeedSub", "Feeds");
}
$delta["dgettext"] = array((microtime(true) - $start) / $times, $result);
$start = microtime(true);
for($i = 0; $i < $times; $i++) {
$result = _dgettext("FeedSub", "Feeds");
}
$delta["_dgettext"] = array((microtime(true) - $start) / $times, $result);
$start = microtime(true);
for($i = 0; $i < $times; $i++) {
$result = _m("Feeds");
}
$delta["_m"] = array((microtime(true) - $start) / $times, $result);
$start = microtime(true);
for($i = 0; $i < $times; $i++) {
$result = fake("Feeds");
}
$delta["fake"] = array((microtime(true) - $start) / $times, $result);
foreach ($delta as $func => $bits) {
list($time, $result) = $bits;
$ms = $time * 1000.0;
printf("%10s %2.4fms %s\n", $func, $ms, $result);
}
function fake($str) {
return $str;
}

View File

@ -177,7 +177,7 @@ class MapstractionPlugin extends Plugin
$action->elementStart('div', array('id' => 'entity_map', $action->elementStart('div', array('id' => 'entity_map',
'class' => 'section')); 'class' => 'section'));
$action->element('h2', null, _('Map')); $action->element('h2', null, _m('Map'));
$action->element('div', array('id' => 'map_canvas', $action->element('div', array('id' => 'map_canvas',
'class' => 'gray smallmap', 'class' => 'gray smallmap',
@ -188,7 +188,7 @@ class MapstractionPlugin extends Plugin
array('nickname' => $action->trimmed('nickname'))); array('nickname' => $action->trimmed('nickname')));
$action->element('a', array('href' => $mapUrl), $action->element('a', array('href' => $mapUrl),
_("Full size")); _m("Full size"));
$action->elementEnd('div'); $action->elementEnd('div');
} }

View File

@ -68,10 +68,10 @@ class AllmapAction extends MapAction
} }
if ($this->page == 1) { if ($this->page == 1) {
return sprintf(_("%s friends map"), return sprintf(_m("%s friends map"),
$base); $base);
} else { } else {
return sprintf(_("%s friends map, page %d"), return sprintf(_m("%s friends map, page %d"),
$base, $base,
$this->page); $this->page);
} }

View File

@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 20:38-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: allmap.php:71
#, php-format
msgid "%s friends map"
msgstr ""
#: allmap.php:74
#, php-format
msgid "%s friends map, page %d"
msgstr ""
#: map.php:72
msgid "No such user."
msgstr ""
#: map.php:79
msgid "User has no profile."
msgstr ""
#: usermap.php:71
#, php-format
msgid "%s map, page %d"
msgstr ""
#: MapstractionPlugin.php:180
msgid "Map"
msgstr ""
#: MapstractionPlugin.php:191
msgid "Full size"
msgstr ""

View File

@ -69,14 +69,14 @@ class MapAction extends OwnerDesignAction
$this->user = User::staticGet('nickname', $nickname); $this->user = User::staticGet('nickname', $nickname);
if (!$this->user) { if (!$this->user) {
$this->clientError(_('No such user.'), 404); $this->clientError(_m('No such user.'), 404);
return false; return false;
} }
$this->profile = $this->user->getProfile(); $this->profile = $this->user->getProfile();
if (!$this->profile) { if (!$this->profile) {
$this->serverError(_('User has no profile.')); $this->serverError(_m('User has no profile.'));
return false; return false;
} }

View File

@ -68,7 +68,7 @@ class UsermapAction extends MapAction
if ($this->page == 1) { if ($this->page == 1) {
return $base; return $base;
} else { } else {
return sprintf(_("%s map, page %d"), return sprintf(_m("%s map, page %d"),
$base, $base,
$this->page); $this->page);
} }

View File

@ -120,8 +120,8 @@ class OpenIDPlugin extends Plugin
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('openidlogin'), $action->menuItem(common_local_url('openidlogin'),
_('OpenID'), _m('OpenID'),
_('Login or register with OpenID'), _m('Login or register with OpenID'),
$action_name === 'openidlogin'); $action_name === 'openidlogin');
return true; return true;
@ -132,8 +132,8 @@ class OpenIDPlugin extends Plugin
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('openidsettings'), $action->menuItem(common_local_url('openidsettings'),
_('OpenID'), _m('OpenID'),
_('Add or remove OpenIDs'), _m('Add or remove OpenIDs'),
$action_name === 'openidsettings'); $action_name === 'openidsettings');
return true; return true;

View File

@ -64,7 +64,7 @@ class FinishaddopenidAction extends Action
{ {
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
$this->clientError(_('Not logged in.')); $this->clientError(_m('Not logged in.'));
} else { } else {
$this->tryLogin(); $this->tryLogin();
} }
@ -85,11 +85,11 @@ class FinishaddopenidAction extends Action
$response = $consumer->complete(common_local_url('finishaddopenid')); $response = $consumer->complete(common_local_url('finishaddopenid'));
if ($response->status == Auth_OpenID_CANCEL) { if ($response->status == Auth_OpenID_CANCEL) {
$this->message(_('OpenID authentication cancelled.')); $this->message(_m('OpenID authentication cancelled.'));
return; return;
} else if ($response->status == Auth_OpenID_FAILURE) { } else if ($response->status == Auth_OpenID_FAILURE) {
// Authentication failed; display the error message. // Authentication failed; display the error message.
$this->message(sprintf(_('OpenID authentication failed: %s'), $this->message(sprintf(_m('OpenID authentication failed: %s'),
$response->message)); $response->message));
} else if ($response->status == Auth_OpenID_SUCCESS) { } else if ($response->status == Auth_OpenID_SUCCESS) {
@ -109,9 +109,9 @@ class FinishaddopenidAction extends Action
if ($other) { if ($other) {
if ($other->id == $cur->id) { if ($other->id == $cur->id) {
$this->message(_('You already have this OpenID!')); $this->message(_m('You already have this OpenID!'));
} else { } else {
$this->message(_('Someone else already has this OpenID.')); $this->message(_m('Someone else already has this OpenID.'));
} }
return; return;
} }
@ -123,12 +123,12 @@ class FinishaddopenidAction extends Action
$result = oid_link_user($cur->id, $canonical, $display); $result = oid_link_user($cur->id, $canonical, $display);
if (!$result) { if (!$result) {
$this->message(_('Error connecting user.')); $this->message(_m('Error connecting user.'));
return; return;
} }
if ($sreg) { if ($sreg) {
if (!oid_update_user($cur, $sreg)) { if (!oid_update_user($cur, $sreg)) {
$this->message(_('Error updating profile')); $this->message(_m('Error updating profile'));
return; return;
} }
} }
@ -167,7 +167,7 @@ class FinishaddopenidAction extends Action
function title() function title()
{ {
return _('OpenID Login'); return _m('OpenID Login');
} }
/** /**

View File

@ -31,16 +31,16 @@ class FinishopenidloginAction extends Action
{ {
parent::handle($args); parent::handle($args);
if (common_is_real_login()) { if (common_is_real_login()) {
$this->clientError(_('Already logged in.')); $this->clientError(_m('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. Try again, please.')); $this->showForm(_m('There was a problem with your session token. Try again, please.'));
return; return;
} }
if ($this->arg('create')) { if ($this->arg('create')) {
if (!$this->boolean('license')) { if (!$this->boolean('license')) {
$this->showForm(_('You can\'t register if you don\'t agree to the license.'), $this->showForm(_m('You can\'t register if you don\'t agree to the license.'),
$this->trimmed('newname')); $this->trimmed('newname'));
return; return;
} }
@ -49,7 +49,7 @@ class FinishopenidloginAction extends Action
$this->connectUser(); $this->connectUser();
} else { } else {
common_debug(print_r($this->args, true), __FILE__); common_debug(print_r($this->args, true), __FILE__);
$this->showForm(_('Something weird happened.'), $this->showForm(_m('Something weird happened.'),
$this->trimmed('newname')); $this->trimmed('newname'));
} }
} else { } else {
@ -63,13 +63,13 @@ class FinishopenidloginAction extends Action
$this->element('div', array('class' => 'error'), $this->error); $this->element('div', array('class' => 'error'), $this->error);
} else { } else {
$this->element('div', 'instructions', $this->element('div', 'instructions',
sprintf(_('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name'))); sprintf(_m('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
} }
} }
function title() function title()
{ {
return _('OpenID Account Setup'); return _m('OpenID Account Setup');
} }
function showForm($error=null, $username=null) function showForm($error=null, $username=null)
@ -94,14 +94,14 @@ class FinishopenidloginAction extends Action
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->elementStart('fieldset', array('id' => 'form_openid_createaccount')); $this->elementStart('fieldset', array('id' => 'form_openid_createaccount'));
$this->element('legend', null, $this->element('legend', null,
_('Create new account')); _m('Create new account'));
$this->element('p', null, $this->element('p', null,
_('Create a new user with this nickname.')); _m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('newname', _('New nickname'), $this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '', ($this->username) ? $this->username : '',
_('1-64 lowercase letters or numbers, no punctuation or spaces')); _m('1-64 lowercase letters or numbers, no punctuation or spaces'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->element('input', array('type' => 'checkbox', $this->element('input', array('type' => 'checkbox',
@ -111,30 +111,30 @@ class FinishopenidloginAction extends Action
'value' => 'true')); 'value' => 'true'));
$this->elementStart('label', array('for' => 'license', $this->elementStart('label', array('for' => 'license',
'class' => 'checkbox')); 'class' => 'checkbox'));
$this->text(_('My text and files are available under ')); $this->text(_m('My text and files are available under '));
$this->element('a', array('href' => common_config('license', 'url')), $this->element('a', array('href' => common_config('license', 'url')),
common_config('license', 'title')); common_config('license', 'title'));
$this->text(_(' except this private data: password, email address, IM address, phone number.')); $this->text(_m(' except this private data: password, email address, IM address, phone number.'));
$this->elementEnd('label'); $this->elementEnd('label');
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('create', _('Create')); $this->submit('create', _m('Create'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementStart('fieldset', array('id' => 'form_openid_createaccount')); $this->elementStart('fieldset', array('id' => 'form_openid_createaccount'));
$this->element('legend', null, $this->element('legend', null,
_('Connect existing account')); _m('Connect existing account'));
$this->element('p', null, $this->element('p', null,
_('If you already have an account, login with your username and password to connect it to your OpenID.')); _m('If you already have an account, login with your username and password to connect it to your OpenID.'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('nickname', _('Existing nickname')); $this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->password('password', _('Password')); $this->password('password', _m('Password'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('connect', _('Connect')); $this->submit('connect', _m('Connect'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
} }
@ -146,11 +146,11 @@ class FinishopenidloginAction extends Action
$response = $consumer->complete(common_local_url('finishopenidlogin')); $response = $consumer->complete(common_local_url('finishopenidlogin'));
if ($response->status == Auth_OpenID_CANCEL) { if ($response->status == Auth_OpenID_CANCEL) {
$this->message(_('OpenID authentication cancelled.')); $this->message(_m('OpenID authentication cancelled.'));
return; return;
} else if ($response->status == Auth_OpenID_FAILURE) { } else if ($response->status == Auth_OpenID_FAILURE) {
// Authentication failed; display the error message. // Authentication failed; display the error message.
$this->message(sprintf(_('OpenID authentication failed: %s'), $response->message)); $this->message(sprintf(_m('OpenID authentication failed: %s'), $response->message));
} else if ($response->status == Auth_OpenID_SUCCESS) { } else if ($response->status == Auth_OpenID_SUCCESS) {
// This means the authentication succeeded; extract the // This means the authentication succeeded; extract the
// identity URL and Simple Registration data (if it was // identity URL and Simple Registration data (if it was
@ -212,7 +212,7 @@ class FinishopenidloginAction extends Action
# FIXME: save invite code before redirect, and check here # FIXME: save invite code before redirect, and check here
if (common_config('site', 'closed')) { if (common_config('site', 'closed')) {
$this->clientError(_('Registration not allowed.')); $this->clientError(_m('Registration not allowed.'));
return; return;
} }
@ -221,14 +221,14 @@ class FinishopenidloginAction extends Action
if (common_config('site', 'inviteonly')) { if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode']; $code = $_SESSION['invitecode'];
if (empty($code)) { if (empty($code)) {
$this->clientError(_('Registration not allowed.')); $this->clientError(_m('Registration not allowed.'));
return; return;
} }
$invite = Invitation::staticGet($code); $invite = Invitation::staticGet($code);
if (empty($invite)) { if (empty($invite)) {
$this->clientError(_('Not a valid invitation code.')); $this->clientError(_m('Not a valid invitation code.'));
return; return;
} }
} }
@ -238,24 +238,24 @@ class FinishopenidloginAction extends Action
if (!Validate::string($nickname, array('min_length' => 1, if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64, 'max_length' => 64,
'format' => NICKNAME_FMT))) { 'format' => NICKNAME_FMT))) {
$this->showForm(_('Nickname must have only lowercase letters and numbers and no spaces.')); $this->showForm(_m('Nickname must have only lowercase letters and numbers and no spaces.'));
return; return;
} }
if (!User::allowed_nickname($nickname)) { if (!User::allowed_nickname($nickname)) {
$this->showForm(_('Nickname not allowed.')); $this->showForm(_m('Nickname not allowed.'));
return; return;
} }
if (User::staticGet('nickname', $nickname)) { if (User::staticGet('nickname', $nickname)) {
$this->showForm(_('Nickname already in use. Try another one.')); $this->showForm(_m('Nickname already in use. Try another one.'));
return; return;
} }
list($display, $canonical, $sreg) = $this->getSavedValues(); list($display, $canonical, $sreg) = $this->getSavedValues();
if (!$display || !$canonical) { if (!$display || !$canonical) {
$this->serverError(_('Stored OpenID not found.')); $this->serverError(_m('Stored OpenID not found.'));
return; return;
} }
@ -264,7 +264,7 @@ class FinishopenidloginAction extends Action
$other = oid_get_user($canonical); $other = oid_get_user($canonical);
if ($other) { if ($other) {
$this->serverError(_('Creating new account for OpenID that already has a user.')); $this->serverError(_m('Creating new account for OpenID that already has a user.'));
return; return;
} }
@ -324,7 +324,7 @@ class FinishopenidloginAction extends Action
$password = $this->trimmed('password'); $password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) { if (!common_check_user($nickname, $password)) {
$this->showForm(_('Invalid username or password.')); $this->showForm(_m('Invalid username or password.'));
return; return;
} }
@ -335,14 +335,14 @@ class FinishopenidloginAction extends Action
list($display, $canonical, $sreg) = $this->getSavedValues(); list($display, $canonical, $sreg) = $this->getSavedValues();
if (!$display || !$canonical) { if (!$display || !$canonical) {
$this->serverError(_('Stored OpenID not found.')); $this->serverError(_m('Stored OpenID not found.'));
return; return;
} }
$result = oid_link_user($user->id, $canonical, $display); $result = oid_link_user($user->id, $canonical, $display);
if (!$result) { if (!$result) {
$this->serverError(_('Error connecting user to OpenID.')); $this->serverError(_m('Error connecting user to OpenID.'));
return; return;
} }

View File

@ -0,0 +1,344 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 20:38-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: openidlogin.php:30 finishopenidlogin.php:34
msgid "Already logged in."
msgstr ""
#: openidlogin.php:37 openidsettings.php:194 finishopenidlogin.php:38
msgid "There was a problem with your session token. Try again, please."
msgstr ""
#: openidlogin.php:66
#, php-format
msgid ""
"For security reasons, please re-login with your [OpenID](%%doc.openid%%) "
"before changing your settings."
msgstr ""
#: openidlogin.php:70
#, php-format
msgid "Login with an [OpenID](%%doc.openid%%) account."
msgstr ""
#: openidlogin.php:95 finishaddopenid.php:170
msgid "OpenID Login"
msgstr ""
#: openidlogin.php:112
msgid "OpenID login"
msgstr ""
#: openidlogin.php:117 openidsettings.php:107
msgid "OpenID URL"
msgstr ""
#: openidlogin.php:119
msgid "Your OpenID URL"
msgstr ""
#: openidlogin.php:122
msgid "Remember me"
msgstr ""
#: openidlogin.php:123
msgid "Automatically login in the future; not for shared computers!"
msgstr ""
#: openidlogin.php:127
msgid "Login"
msgstr ""
#: openidserver.php:106
#, php-format
msgid "You are not authorized to use the identity %s"
msgstr ""
#: openidserver.php:126
msgid "Just an OpenID provider. Nothing to see here, move along..."
msgstr ""
#: OpenIDPlugin.php:123 OpenIDPlugin.php:135
msgid "OpenID"
msgstr ""
#: OpenIDPlugin.php:124
msgid "Login or register with OpenID"
msgstr ""
#: OpenIDPlugin.php:136
msgid "Add or remove OpenIDs"
msgstr ""
#: openid.php:141
msgid "Cannot instantiate OpenID consumer object."
msgstr ""
#: openid.php:151
msgid "Not a valid OpenID."
msgstr ""
#: openid.php:153
#, php-format
msgid "OpenID failure: %s"
msgstr ""
#: openid.php:180
#, php-format
msgid "Could not redirect to server: %s"
msgstr ""
#: openid.php:198
#, php-format
msgid "Could not create OpenID form: %s"
msgstr ""
#: openid.php:214
msgid ""
"This form should automatically submit itself. If not, click the submit "
"button to go to your OpenID provider."
msgstr ""
#: openid.php:246
msgid "Error saving the profile."
msgstr ""
#: openid.php:257
msgid "Error saving the user."
msgstr ""
#: openid.php:277
msgid "OpenID Auto-Submit"
msgstr ""
#: openidtrust.php:51
msgid "OpenID Identity Verification"
msgstr ""
#: openidtrust.php:69
msgid ""
"This page should only be reached during OpenID processing, not directly."
msgstr ""
#: openidtrust.php:118
#, php-format
msgid ""
"%s has asked to verify your identity. Click Continue to verify your "
"identity and login without creating a new password."
msgstr ""
#: openidtrust.php:136
msgid "Continue"
msgstr ""
#: openidtrust.php:137
msgid "Cancel"
msgstr ""
#: finishaddopenid.php:67
msgid "Not logged in."
msgstr ""
#: finishaddopenid.php:88 finishopenidlogin.php:149
msgid "OpenID authentication cancelled."
msgstr ""
#: finishaddopenid.php:92 finishopenidlogin.php:153
#, php-format
msgid "OpenID authentication failed: %s"
msgstr ""
#: finishaddopenid.php:112
msgid "You already have this OpenID!"
msgstr ""
#: finishaddopenid.php:114
msgid "Someone else already has this OpenID."
msgstr ""
#: finishaddopenid.php:126
msgid "Error connecting user."
msgstr ""
#: finishaddopenid.php:131
msgid "Error updating profile"
msgstr ""
#: openidsettings.php:59
msgid "OpenID settings"
msgstr ""
#: openidsettings.php:70
#, php-format
msgid ""
"[OpenID](%%doc.openid%%) lets you log into many sites with the same user "
"account. Manage your associated OpenIDs from here."
msgstr ""
#: openidsettings.php:99
msgid "Add OpenID"
msgstr ""
#: openidsettings.php:102
msgid ""
"If you want to add an OpenID to your account, enter it in the box below and "
"click \"Add\"."
msgstr ""
#: openidsettings.php:117
msgid "Add"
msgstr ""
#: openidsettings.php:129
msgid "Remove OpenID"
msgstr ""
#: openidsettings.php:134
msgid ""
"Removing your only OpenID would make it impossible to log in! If you need to "
"remove it, add another OpenID first."
msgstr ""
#: openidsettings.php:149
msgid ""
"You can remove an OpenID from your account by clicking the button marked "
"\"Remove\"."
msgstr ""
#: openidsettings.php:172
msgid "Remove"
msgstr ""
#: openidsettings.php:208 finishopenidlogin.php:52
msgid "Something weird happened."
msgstr ""
#: openidsettings.php:228
msgid "No such OpenID."
msgstr ""
#: openidsettings.php:233
msgid "That OpenID does not belong to you."
msgstr ""
#: openidsettings.php:237
msgid "OpenID removed."
msgstr ""
#: finishopenidlogin.php:43
msgid "You can't register if you don't agree to the license."
msgstr ""
#: finishopenidlogin.php:66
#, php-format
msgid ""
"This is the first time you've logged into %s so we must connect your OpenID "
"to a local account. You can either create a new account, or connect with "
"your existing account, if you have one."
msgstr ""
#: finishopenidlogin.php:72
msgid "OpenID Account Setup"
msgstr ""
#: finishopenidlogin.php:97
msgid "Create new account"
msgstr ""
#: finishopenidlogin.php:99
msgid "Create a new user with this nickname."
msgstr ""
#: finishopenidlogin.php:102
msgid "New nickname"
msgstr ""
#: finishopenidlogin.php:104
msgid "1-64 lowercase letters or numbers, no punctuation or spaces"
msgstr ""
#: finishopenidlogin.php:114
msgid "My text and files are available under "
msgstr ""
#: finishopenidlogin.php:117
msgid ""
" except this private data: password, email address, IM address, phone number."
msgstr ""
#: finishopenidlogin.php:121
msgid "Create"
msgstr ""
#: finishopenidlogin.php:126
msgid "Connect existing account"
msgstr ""
#: finishopenidlogin.php:128
msgid ""
"If you already have an account, login with your username and password to "
"connect it to your OpenID."
msgstr ""
#: finishopenidlogin.php:131
msgid "Existing nickname"
msgstr ""
#: finishopenidlogin.php:134
msgid "Password"
msgstr ""
#: finishopenidlogin.php:137
msgid "Connect"
msgstr ""
#: finishopenidlogin.php:215 finishopenidlogin.php:224
msgid "Registration not allowed."
msgstr ""
#: finishopenidlogin.php:231
msgid "Not a valid invitation code."
msgstr ""
#: finishopenidlogin.php:241
msgid "Nickname must have only lowercase letters and numbers and no spaces."
msgstr ""
#: finishopenidlogin.php:246
msgid "Nickname not allowed."
msgstr ""
#: finishopenidlogin.php:251
msgid "Nickname already in use. Try another one."
msgstr ""
#: finishopenidlogin.php:258 finishopenidlogin.php:338
msgid "Stored OpenID not found."
msgstr ""
#: finishopenidlogin.php:267
msgid "Creating new account for OpenID that already has a user."
msgstr ""
#: finishopenidlogin.php:327
msgid "Invalid username or password."
msgstr ""
#: finishopenidlogin.php:345
msgid "Error connecting user to OpenID."
msgstr ""

View File

@ -138,7 +138,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
$consumer = oid_consumer(); $consumer = oid_consumer();
if (!$consumer) { if (!$consumer) {
common_server_error(_('Cannot instantiate OpenID consumer object.')); common_server_error(_m('Cannot instantiate OpenID consumer object.'));
return false; return false;
} }
@ -148,9 +148,9 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
// Handle failure status return values. // Handle failure status return values.
if (!$auth_request) { if (!$auth_request) {
return _('Not a valid OpenID.'); return _m('Not a valid OpenID.');
} else if (Auth_OpenID::isFailure($auth_request)) { } else if (Auth_OpenID::isFailure($auth_request)) {
return sprintf(_('OpenID failure: %s'), $auth_request->message); return sprintf(_m('OpenID failure: %s'), $auth_request->message);
} }
$sreg_request = Auth_OpenID_SRegRequest::build(// Required $sreg_request = Auth_OpenID_SRegRequest::build(// Required
@ -177,7 +177,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
$immediate); $immediate);
if (!$redirect_url) { if (!$redirect_url) {
} else if (Auth_OpenID::isFailure($redirect_url)) { } else if (Auth_OpenID::isFailure($redirect_url)) {
return sprintf(_('Could not redirect to server: %s'), $redirect_url->message); return sprintf(_m('Could not redirect to server: %s'), $redirect_url->message);
} else { } else {
common_redirect($redirect_url, 303); common_redirect($redirect_url, 303);
} }
@ -195,7 +195,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
// Display an error if the form markup couldn't be generated; // Display an error if the form markup couldn't be generated;
// otherwise, render the HTML. // otherwise, render the HTML.
if (Auth_OpenID::isFailure($form_html)) { if (Auth_OpenID::isFailure($form_html)) {
common_server_error(sprintf(_('Could not create OpenID form: %s'), $form_html->message)); common_server_error(sprintf(_m('Could not create OpenID form: %s'), $form_html->message));
} else { } else {
$action = new AutosubmitAction(); // see below $action = new AutosubmitAction(); // see below
$action->form_html = $form_html; $action->form_html = $form_html;
@ -211,7 +211,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
function _oid_print_instructions() function _oid_print_instructions()
{ {
common_element('div', 'instructions', common_element('div', 'instructions',
_('This form should automatically submit itself. '. _m('This form should automatically submit itself. '.
'If not, click the submit button to go to your '. 'If not, click the submit button to go to your '.
'OpenID provider.')); 'OpenID provider.'));
} }
@ -243,7 +243,7 @@ function oid_update_user(&$user, &$sreg)
# XXX save timezone if it's passed # XXX save timezone if it's passed
if (!$profile->update($orig_profile)) { if (!$profile->update($orig_profile)) {
common_server_error(_('Error saving the profile.')); common_server_error(_m('Error saving the profile.'));
return false; return false;
} }
@ -254,7 +254,7 @@ function oid_update_user(&$user, &$sreg)
} }
if (!$user->update($orig_user)) { if (!$user->update($orig_user)) {
common_server_error(_('Error saving the user.')); common_server_error(_m('Error saving the user.'));
return false; return false;
} }
@ -274,7 +274,7 @@ class AutosubmitAction extends Action
function title() function title()
{ {
return _('OpenID Auto-Submit'); return _m('OpenID Auto-Submit');
} }
function showContent() function showContent()

View File

@ -27,14 +27,14 @@ class OpenidloginAction extends Action
{ {
parent::handle($args); parent::handle($args);
if (common_is_real_login()) { if (common_is_real_login()) {
$this->clientError(_('Already logged in.')); $this->clientError(_m('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$openid_url = $this->trimmed('openid_url'); $openid_url = $this->trimmed('openid_url');
# CSRF protection # CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. Try again, please.'), $openid_url); $this->showForm(_m('There was a problem with your session token. Try again, please.'), $openid_url);
return; return;
} }
@ -63,11 +63,11 @@ class OpenidloginAction extends Action
common_get_returnto()) { common_get_returnto()) {
// rememberme logins have to reauthenticate before // rememberme logins have to reauthenticate before
// changing any profile settings (cookie-stealing protection) // changing any profile settings (cookie-stealing protection)
return _('For security reasons, please re-login with your ' . return _m('For security reasons, please re-login with your ' .
'[OpenID](%%doc.openid%%) ' . '[OpenID](%%doc.openid%%) ' .
'before changing your settings.'); 'before changing your settings.');
} else { } else {
return _('Login with an [OpenID](%%doc.openid%%) account.'); return _m('Login with an [OpenID](%%doc.openid%%) account.');
} }
} }
@ -92,7 +92,7 @@ class OpenidloginAction extends Action
function title() function title()
{ {
return _('OpenID Login'); return _m('OpenID Login');
} }
function showForm($error=null, $openid_url) function showForm($error=null, $openid_url)
@ -109,22 +109,22 @@ class OpenidloginAction extends Action
'class' => 'form_settings', 'class' => 'form_settings',
'action' => $formaction)); 'action' => $formaction));
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->element('legend', null, _('OpenID login')); $this->element('legend', null, _m('OpenID login'));
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('openid_url', _('OpenID URL'), $this->input('openid_url', _m('OpenID URL'),
$this->openid_url, $this->openid_url,
_('Your OpenID URL')); _m('Your OpenID URL'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li', array('id' => 'settings_rememberme')); $this->elementStart('li', array('id' => 'settings_rememberme'));
$this->checkbox('rememberme', _('Remember me'), false, $this->checkbox('rememberme', _m('Remember me'), false,
_('Automatically login in the future; ' . _m('Automatically login in the future; ' .
'not for shared computers!')); 'not for shared computers!'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('submit', _('Login')); $this->submit('submit', _m('Login'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
} }

View File

@ -103,7 +103,7 @@ class OpenidserverAction extends Action
$response = $this->generateDenyResponse($request); $response = $this->generateDenyResponse($request);
} else { } else {
//invalid //invalid
$this->clientError(sprintf(_('You are not authorized to use the identity %s'),$request->identity),$code=403); $this->clientError(sprintf(_m('You are not authorized to use the identity %s'),$request->identity),$code=403);
} }
} else { } else {
$response = $this->oserver->handleRequest($request); $response = $this->oserver->handleRequest($request);
@ -123,7 +123,7 @@ class OpenidserverAction extends Action
} }
$this->raw($response->body); $this->raw($response->body);
}else{ }else{
$this->clientError(_('Just an OpenID provider. Nothing to see here, move along...'),$code=500); $this->clientError(_m('Just an OpenID provider. Nothing to see here, move along...'),$code=500);
} }
} }

View File

@ -56,7 +56,7 @@ class OpenidsettingsAction extends AccountSettingsAction
function title() function title()
{ {
return _('OpenID settings'); return _m('OpenID settings');
} }
/** /**
@ -67,7 +67,7 @@ class OpenidsettingsAction extends AccountSettingsAction
function getInstructions() function getInstructions()
{ {
return _('[OpenID](%%doc.openid%%) lets you log into many sites' . return _m('[OpenID](%%doc.openid%%) lets you log into many sites' .
' with the same user account.'. ' with the same user account.'.
' Manage your associated OpenIDs from here.'); ' Manage your associated OpenIDs from here.');
} }
@ -96,15 +96,15 @@ class OpenidsettingsAction extends AccountSettingsAction
'action' => 'action' =>
common_local_url('openidsettings'))); common_local_url('openidsettings')));
$this->elementStart('fieldset', array('id' => 'settings_openid_add')); $this->elementStart('fieldset', array('id' => 'settings_openid_add'));
$this->element('legend', null, _('Add OpenID')); $this->element('legend', null, _m('Add OpenID'));
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->element('p', 'form_guide', $this->element('p', 'form_guide',
_('If you want to add an OpenID to your account, ' . _m('If you want to add an OpenID to your account, ' .
'enter it in the box below and click "Add".')); 'enter it in the box below and click "Add".'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->element('label', array('for' => 'openid_url'), $this->element('label', array('for' => 'openid_url'),
_('OpenID URL')); _m('OpenID URL'));
$this->element('input', array('name' => 'openid_url', $this->element('input', array('name' => 'openid_url',
'type' => 'text', 'type' => 'text',
'id' => 'openid_url')); 'id' => 'openid_url'));
@ -114,7 +114,7 @@ class OpenidsettingsAction extends AccountSettingsAction
'id' => 'settings_openid_add_action-submit', 'id' => 'settings_openid_add_action-submit',
'name' => 'add', 'name' => 'add',
'class' => 'submit', 'class' => 'submit',
'value' => _('Add'))); 'value' => _m('Add')));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
@ -126,12 +126,12 @@ class OpenidsettingsAction extends AccountSettingsAction
if ($cnt > 0) { if ($cnt > 0) {
$this->element('h2', null, _('Remove OpenID')); $this->element('h2', null, _m('Remove OpenID'));
if ($cnt == 1 && !$user->password) { if ($cnt == 1 && !$user->password) {
$this->element('p', 'form_guide', $this->element('p', 'form_guide',
_('Removing your only OpenID '. _m('Removing your only OpenID '.
'would make it impossible to log in! ' . 'would make it impossible to log in! ' .
'If you need to remove it, '. 'If you need to remove it, '.
'add another OpenID first.')); 'add another OpenID first.'));
@ -146,7 +146,7 @@ class OpenidsettingsAction extends AccountSettingsAction
} else { } else {
$this->element('p', 'form_guide', $this->element('p', 'form_guide',
_('You can remove an OpenID from your account '. _m('You can remove an OpenID from your account '.
'by clicking the button marked "Remove".')); 'by clicking the button marked "Remove".'));
$idx = 0; $idx = 0;
@ -169,7 +169,7 @@ class OpenidsettingsAction extends AccountSettingsAction
'id' => 'remove'.$idx, 'id' => 'remove'.$idx,
'name' => 'remove', 'name' => 'remove',
'class' => 'submit remove', 'class' => 'submit remove',
'value' => _('Remove'))); 'value' => _m('Remove')));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
$idx++; $idx++;
@ -191,7 +191,7 @@ class OpenidsettingsAction extends AccountSettingsAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_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.')); 'Try again, please.'));
return; return;
} }
@ -205,7 +205,7 @@ class OpenidsettingsAction extends AccountSettingsAction
} else if ($this->arg('remove')) { } else if ($this->arg('remove')) {
$this->removeOpenid(); $this->removeOpenid();
} else { } else {
$this->showForm(_('Something weird happened.')); $this->showForm(_m('Something weird happened.'));
} }
} }
@ -225,16 +225,16 @@ class OpenidsettingsAction extends AccountSettingsAction
$oid = User_openid::staticGet('canonical', $openid_url); $oid = User_openid::staticGet('canonical', $openid_url);
if (!$oid) { if (!$oid) {
$this->showForm(_('No such OpenID.')); $this->showForm(_m('No such OpenID.'));
return; return;
} }
$cur = common_current_user(); $cur = common_current_user();
if (!$cur || $oid->user_id != $cur->id) { if (!$cur || $oid->user_id != $cur->id) {
$this->showForm(_('That OpenID does not belong to you.')); $this->showForm(_m('That OpenID does not belong to you.'));
return; return;
} }
$oid->delete(); $oid->delete();
$this->showForm(_('OpenID removed.'), true); $this->showForm(_m('OpenID removed.'), true);
return; return;
} }
} }

View File

@ -48,7 +48,7 @@ class OpenidtrustAction extends Action
function title() function title()
{ {
return _('OpenID Identity Verification'); return _m('OpenID Identity Verification');
} }
function prepare($args) function prepare($args)
@ -66,7 +66,7 @@ class OpenidtrustAction extends Action
$this->allowUrl = $_SESSION['openid_allow_url']; $this->allowUrl = $_SESSION['openid_allow_url'];
$this->denyUrl = $_SESSION['openid_deny_url']; $this->denyUrl = $_SESSION['openid_deny_url'];
if(empty($this->trust_root) || empty($this->allowUrl) || empty($this->denyUrl)){ if(empty($this->trust_root) || empty($this->allowUrl) || empty($this->denyUrl)){
$this->clientError(_('This page should only be reached during OpenID processing, not directly.')); $this->clientError(_m('This page should only be reached during OpenID processing, not directly.'));
return; return;
} }
return true; return true;
@ -115,7 +115,7 @@ class OpenidtrustAction extends Action
function showPageNotice() function showPageNotice()
{ {
$this->element('p',null,sprintf(_('%s has asked to verify your identity. Click Continue to verify your identity and login without creating a new password.'),$this->trust_root)); $this->element('p',null,sprintf(_m('%s has asked to verify your identity. Click Continue to verify your identity and login without creating a new password.'),$this->trust_root));
} }
/** /**
@ -133,8 +133,8 @@ class OpenidtrustAction extends Action
'class' => 'form_settings', 'class' => 'form_settings',
'action' => common_local_url('openidtrust'))); 'action' => common_local_url('openidtrust')));
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->submit('allow', _('Continue')); $this->submit('allow', _m('Continue'));
$this->submit('deny', _('Cancel')); $this->submit('deny', _m('Cancel'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');

View File

@ -0,0 +1,59 @@
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @package SamplePlugin
* @maintainer Your Name <you@example.com>
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
exit(1);
}
class SamplePlugin extends Plugin
{
function onInitializePlugin()
{
// Event handlers normally return true to indicate that all is well.
//
// Returning false will cancel further processing of any other
// plugins or core code hooking the same event.
return true;
}
/**
* Hook for RouterInitialized event.
*
* @param Net_URL_Mapper $m path-to-action mapper
* @return boolean hook return
*/
function onRouterInitialized($m)
{
$m->connect(':nickname/samples',
array('action' => 'showsamples'),
array('feed' => '[A-Za-z0-9_-]+'));
$m->connect('settings/sample',
array('action' => 'samplesettings'));
return true;
}
}

View File

@ -86,8 +86,8 @@ class TwitterBridgePlugin extends Plugin
$action_name = $action->trimmed('action'); $action_name = $action->trimmed('action');
$action->menuItem(common_local_url('twittersettings'), $action->menuItem(common_local_url('twittersettings'),
_('Twitter'), _m('Twitter'),
_('Twitter integration options'), _m('Twitter integration options'),
$action_name === 'twittersettings'); $action_name === 'twittersettings');
return true; return true;

View File

@ -0,0 +1,128 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 20:38-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: twitterauthorization.php:81
msgid "Not logged in."
msgstr ""
#: twitterauthorization.php:131 twitterauthorization.php:150
#: twitterauthorization.php:170 twitterauthorization.php:217
msgid "Couldn't link your Twitter account."
msgstr ""
#: TwitterBridgePlugin.php:89
msgid "Twitter"
msgstr ""
#: TwitterBridgePlugin.php:90
msgid "Twitter integration options"
msgstr ""
#: twittersettings.php:59
msgid "Twitter settings"
msgstr ""
#: twittersettings.php:70
msgid ""
"Connect your Twitter account to share your updates with your Twitter friends "
"and vice-versa."
msgstr ""
#: twittersettings.php:118
msgid "Twitter account"
msgstr ""
#: twittersettings.php:123
msgid "Connected Twitter account"
msgstr ""
#: twittersettings.php:125
msgid "Remove"
msgstr ""
#: twittersettings.php:131
msgid "Preferences"
msgstr ""
#: twittersettings.php:135
msgid "Automatically send my notices to Twitter."
msgstr ""
#: twittersettings.php:142
msgid "Send local \"@\" replies to Twitter."
msgstr ""
#: twittersettings.php:149
msgid "Subscribe to my Twitter friends here."
msgstr ""
#: twittersettings.php:158
msgid "Import my Friends Timeline."
msgstr ""
#: twittersettings.php:174
msgid "Save"
msgstr ""
#: twittersettings.php:176
msgid "Add"
msgstr ""
#: twittersettings.php:201
msgid "There was a problem with your session token. Try again, please."
msgstr ""
#: twittersettings.php:211
msgid "Unexpected form submission."
msgstr ""
#: twittersettings.php:230
msgid "Couldn't remove Twitter user."
msgstr ""
#: twittersettings.php:234
msgid "Twitter account removed."
msgstr ""
#: twittersettings.php:255 twittersettings.php:265
msgid "Couldn't save Twitter preferences."
msgstr ""
#: twittersettings.php:269
msgid "Twitter preferences saved."
msgstr ""
#: twitter.php:333
msgid "Your Twitter bridge has been disabled."
msgstr ""
#: twitter.php:337
#, php-format
msgid ""
"Hi, %1$s. We're sorry to inform you that your link to Twitter has been "
"disabled. We no longer seem to have permission to update your Twitter "
"status. (Did you revoke %3$s's access?)\n"
"\n"
"You can re-enable your Twitter bridge by visiting your Twitter settings "
"page:\n"
"\n"
"\t%2$s\n"
"\n"
"Regards,\n"
"%3$s\n"
msgstr ""

View File

@ -330,11 +330,11 @@ function mail_twitter_bridge_removed($user)
$profile = $user->getProfile(); $profile = $user->getProfile();
$subject = sprintf(_('Your Twitter bridge has been disabled.')); $subject = sprintf(_m('Your Twitter bridge has been disabled.'));
$site_name = common_config('site', 'name'); $site_name = common_config('site', 'name');
$body = sprintf(_('Hi, %1$s. We\'re sorry to inform you that your ' . $body = sprintf(_m('Hi, %1$s. We\'re sorry to inform you that your ' .
'link to Twitter has been disabled. We no longer seem to have ' . 'link to Twitter has been disabled. We no longer seem to have ' .
'permission to update your Twitter status. (Did you revoke ' . 'permission to update your Twitter status. (Did you revoke ' .
'%3$s\'s access?)' . "\n\n" . '%3$s\'s access?)' . "\n\n" .

View File

@ -78,7 +78,7 @@ class TwitterauthorizationAction extends Action
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
$this->clientError(_('Not logged in.'), 403); $this->clientError(_m('Not logged in.'), 403);
} }
$user = common_current_user(); $user = common_current_user();
@ -128,7 +128,7 @@ class TwitterauthorizationAction extends Action
} catch (OAuthClientException $e) { } catch (OAuthClientException $e) {
$msg = sprintf('OAuth client cURL error - code: %1s, msg: %2s', $msg = sprintf('OAuth client cURL error - code: %1s, msg: %2s',
$e->getCode(), $e->getMessage()); $e->getCode(), $e->getMessage());
$this->serverError(_('Couldn\'t link your Twitter account.')); $this->serverError(_m('Couldn\'t link your Twitter account.'));
} }
common_redirect($auth_link); common_redirect($auth_link);
@ -147,7 +147,7 @@ class TwitterauthorizationAction extends Action
// token we sent them // token we sent them
if ($_SESSION['twitter_request_token'] != $this->oauth_token) { if ($_SESSION['twitter_request_token'] != $this->oauth_token) {
$this->serverError(_('Couldn\'t link your Twitter account.')); $this->serverError(_m('Couldn\'t link your Twitter account.'));
} }
try { try {
@ -167,7 +167,7 @@ class TwitterauthorizationAction extends Action
} catch (OAuthClientException $e) { } catch (OAuthClientException $e) {
$msg = sprintf('OAuth client cURL error - code: %1$s, msg: %2$s', $msg = sprintf('OAuth client cURL error - code: %1$s, msg: %2$s',
$e->getCode(), $e->getMessage()); $e->getCode(), $e->getMessage());
$this->serverError(_('Couldn\'t link your Twitter account.')); $this->serverError(_m('Couldn\'t link your Twitter account.'));
} }
// Save the access token and Twitter user info // Save the access token and Twitter user info
@ -214,7 +214,7 @@ class TwitterauthorizationAction extends Action
if (empty($flink_id)) { if (empty($flink_id)) {
common_log_db_error($flink, 'INSERT', __FILE__); common_log_db_error($flink, 'INSERT', __FILE__);
$this->serverError(_('Couldn\'t link your Twitter account.')); $this->serverError(_m('Couldn\'t link your Twitter account.'));
} }
save_twitter_user($twitter_user->id, $twitter_user->screen_name); save_twitter_user($twitter_user->id, $twitter_user->screen_name);

View File

@ -56,7 +56,7 @@ class TwittersettingsAction extends ConnectSettingsAction
function title() function title()
{ {
return _('Twitter settings'); return _m('Twitter settings');
} }
/** /**
@ -67,8 +67,8 @@ class TwittersettingsAction extends ConnectSettingsAction
function getInstructions() function getInstructions()
{ {
return _('Connect your Twitter account to share your updates ' . return _m('Connect your Twitter account to share your updates ' .
'with your Twitter friends and vice-versa.'); 'with your Twitter friends and vice-versa.');
} }
/** /**
@ -115,38 +115,38 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
} else { } else {
$this->element('legend', null, _('Twitter account')); $this->element('legend', null, _m('Twitter account'));
$this->elementStart('p', array('id' => 'form_confirmed')); $this->elementStart('p', array('id' => 'form_confirmed'));
$this->element('a', array('href' => $fuser->uri), $fuser->nickname); $this->element('a', array('href' => $fuser->uri), $fuser->nickname);
$this->elementEnd('p'); $this->elementEnd('p');
$this->element('p', 'form_note', $this->element('p', 'form_note',
_('Connected Twitter account')); _m('Connected Twitter account'));
$this->submit('remove', _('Remove')); $this->submit('remove', _m('Remove'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementStart('fieldset', array('id' => 'settings_twitter_preferences')); $this->elementStart('fieldset', array('id' => 'settings_twitter_preferences'));
$this->element('legend', null, _('Preferences')); $this->element('legend', null, _m('Preferences'));
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('noticesend', $this->checkbox('noticesend',
_('Automatically send my notices to Twitter.'), _m('Automatically send my notices to Twitter.'),
($flink) ? ($flink) ?
($flink->noticesync & FOREIGN_NOTICE_SEND) : ($flink->noticesync & FOREIGN_NOTICE_SEND) :
true); true);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('replysync', $this->checkbox('replysync',
_('Send local "@" replies to Twitter.'), _m('Send local "@" replies to Twitter.'),
($flink) ? ($flink) ?
($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) :
true); true);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('friendsync', $this->checkbox('friendsync',
_('Subscribe to my Twitter friends here.'), _m('Subscribe to my Twitter friends here.'),
($flink) ? ($flink) ?
($flink->friendsync & FOREIGN_FRIEND_RECV) : ($flink->friendsync & FOREIGN_FRIEND_RECV) :
false); false);
@ -155,7 +155,7 @@ class TwittersettingsAction extends ConnectSettingsAction
if (common_config('twitterimport','enabled')) { if (common_config('twitterimport','enabled')) {
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('noticerecv', $this->checkbox('noticerecv',
_('Import my Friends Timeline.'), _m('Import my Friends Timeline.'),
($flink) ? ($flink) ?
($flink->noticesync & FOREIGN_NOTICE_RECV) : ($flink->noticesync & FOREIGN_NOTICE_RECV) :
false); false);
@ -171,9 +171,9 @@ class TwittersettingsAction extends ConnectSettingsAction
$this->elementEnd('ul'); $this->elementEnd('ul');
if ($flink) { if ($flink) {
$this->submit('save', _('Save')); $this->submit('save', _m('Save'));
} else { } else {
$this->submit('add', _('Add')); $this->submit('add', _m('Add'));
} }
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -198,8 +198,8 @@ class TwittersettingsAction extends ConnectSettingsAction
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_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.')); 'Try again, please.'));
return; return;
} }
@ -208,7 +208,7 @@ class TwittersettingsAction extends ConnectSettingsAction
} else if ($this->arg('remove')) { } else if ($this->arg('remove')) {
$this->removeTwitterAccount(); $this->removeTwitterAccount();
} else { } else {
$this->showForm(_('Unexpected form submission.')); $this->showForm(_m('Unexpected form submission.'));
} }
} }
@ -227,11 +227,11 @@ class TwittersettingsAction extends ConnectSettingsAction
if (empty($result)) { if (empty($result)) {
common_log_db_error($flink, 'DELETE', __FILE__); common_log_db_error($flink, 'DELETE', __FILE__);
$this->serverError(_('Couldn\'t remove Twitter user.')); $this->serverError(_m('Couldn\'t remove Twitter user.'));
return; return;
} }
$this->showForm(_('Twitter account removed.'), true); $this->showForm(_m('Twitter account removed.'), true);
} }
/** /**
@ -252,7 +252,7 @@ class TwittersettingsAction extends ConnectSettingsAction
if (empty($flink)) { if (empty($flink)) {
common_log_db_error($flink, 'SELECT', __FILE__); common_log_db_error($flink, 'SELECT', __FILE__);
$this->showForm(_('Couldn\'t save Twitter preferences.')); $this->showForm(_m('Couldn\'t save Twitter preferences.'));
return; return;
} }
@ -262,11 +262,11 @@ class TwittersettingsAction extends ConnectSettingsAction
if ($result === false) { if ($result === false) {
common_log_db_error($flink, 'UPDATE', __FILE__); common_log_db_error($flink, 'UPDATE', __FILE__);
$this->showForm(_('Couldn\'t save Twitter preferences.')); $this->showForm(_m('Couldn\'t save Twitter preferences.'));
return; return;
} }
$this->showForm(_('Twitter preferences saved.'), true); $this->showForm(_m('Twitter preferences saved.'), true);
} }
} }

211
scripts/update_po_templates.php Executable file
View File

@ -0,0 +1,211 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Abort if called from a web server
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
print "This script must be run from the command line\n";
exit();
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
function update_core($dir, $domain)
{
$old = getcwd();
chdir($dir);
passthru(<<<END
xgettext \
--from-code=UTF-8 \
--default-domain=$domain \
--output=locale/$domain.po \
--language=PHP \
--keyword="_m:1" \
--keyword="pgettext:1c,2" \
--keyword="npgettext:1c,2,3" \
actions/*.php \
classes/*.php \
lib/*.php \
scripts/*.php
END
);
chdir($old);
}
function do_update_plugin($dir, $domain)
{
$old = getcwd();
chdir($dir);
if (!file_exists('locale')) {
mkdir('locale');
}
$files = get_plugin_sources(".");
$cmd = <<<END
xgettext \
--from-code=UTF-8 \
--default-domain=$domain \
--output=locale/$domain.po \
--language=PHP \
--keyword='' \
--keyword="_m:1" \
END;
foreach ($files as $file) {
$cmd .= ' ' . escapeshellarg($file);
}
passthru($cmd);
chdir($old);
}
function do_translatewiki_plugin($basedir, $plugin)
{
$yamldir = "$basedir/locale/TranslateWiki";
if (!file_exists($yamldir)) {
mkdir($yamldir);
}
$outfile = "$yamldir/StatusNet-{$plugin}.yml";
$data = <<<END
---
BASIC:
id: out-statusnet-{$plugin}
label: StatusNet - {$plugin}
description: "{{int:bw-desc-statusnet-plugin-{$plugin}}}"
namespace: NS_STATUSNET
display: out/statusnet/{$plugin}
class: GettextMessageGroup
FILES:
class: GettextFFS
sourcePattern: %GROUPROOT%/plugins/{$plugin}/locale/%CODE%/LC_MESSAGES/{$plugin}.po
targetPattern: {$plugin}.po
codeMap:
en-gb: en_GB
no: nb
pt-br: pt_BR
zh-hans: zh_CN
zh-hant: zh_TW
MANGLER
class: StringMatcher
prefix: {$plugin}-
patterns:
- "*"
END;
file_put_contents($outfile, $data);
}
function get_plugins($dir)
{
$plugins = array();
$dirs = new DirectoryIterator("$dir/plugins");
foreach ($dirs as $item) {
if ($item->isDir() && !$item->isDot()) {
$name = $item->getBasename();
if (file_exists("$dir/plugins/$name/{$name}Plugin.php")) {
$plugins[] = $name;
}
}
}
return $plugins;
}
function get_plugin_sources($dir)
{
$files = array();
$dirs = new RecursiveDirectoryIterator($dir);
$iter = new RecursiveIteratorIterator($dirs);
foreach ($iter as $pathname => $item) {
if ($item->isFile() && preg_match('/\.php$/', $item->getBaseName())) {
$files[] = $pathname;
}
}
return $files;
}
function plugin_using_gettext($dir)
{
$files = get_plugin_sources($dir);
foreach ($files as $pathname) {
// Check if the file is using our _m gettext wrapper
$code = file_get_contents($pathname);
if (preg_match('/\b_m\(/', $code)) {
return true;
}
}
return false;
}
function update_plugin($basedir, $name)
{
$dir = "$basedir/plugins/$name";
if (plugin_using_gettext($dir)) {
do_update_plugin($dir, $name);
do_translatewiki_plugin($basedir, $name);
return true;
} else {
return false;
}
}
$args = $_SERVER['argv'];
array_shift($args);
$all = false;
$core = false;
$allplugins = false;
$plugins = array();
if (count($args) == 0) {
$all = true;
}
foreach ($args as $arg) {
if ($arg == '--all') {
$all = true;
} elseif ($arg == "--core") {
$core = true;
} elseif ($arg == "--plugins") {
$allplugins = true;
} elseif (substr($arg, 0, 9) == "--plugin=") {
$plugins[] = substr($arg, 9);
}
}
if ($all || $core) {
echo "core...";
update_core(INSTALLDIR, 'statusnet');
echo " ok\n";
}
if ($all || $allplugins) {
$plugins = get_plugins(INSTALLDIR);
}
if ($plugins) {
foreach ($plugins as $plugin) {
echo "$plugin...";
if (update_plugin(INSTALLDIR, $plugin)) {
echo " ok\n";
} else {
echo " not localized\n";
}
}
}

View File

@ -1,13 +0,0 @@
cd `dirname $0`
cd ..
xgettext \
--from-code=UTF-8 \
--default-domain=statusnet \
--output=locale/statusnet.po \
--language=PHP \
--keyword="pgettext:1c,2" \
--keyword="npgettext:1c,2,3" \
actions/*.php \
classes/*.php \
lib/*.php \
scripts/*.php