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

View File

@@ -86,8 +86,8 @@ class TwitterBridgePlugin extends Plugin
$action_name = $action->trimmed('action');
$action->menuItem(common_local_url('twittersettings'),
_('Twitter'),
_('Twitter integration options'),
_m('Twitter'),
_m('Twitter integration options'),
$action_name === 'twittersettings');
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();
$subject = sprintf(_('Your Twitter bridge has been disabled.'));
$subject = sprintf(_m('Your Twitter bridge has been disabled.'));
$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 ' .
'permission to update your Twitter status. (Did you revoke ' .
'%3$s\'s access?)' . "\n\n" .

View File

@@ -78,7 +78,7 @@ class TwitterauthorizationAction extends Action
parent::handle($args);
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'), 403);
$this->clientError(_m('Not logged in.'), 403);
}
$user = common_current_user();
@@ -128,7 +128,7 @@ class TwitterauthorizationAction extends Action
} catch (OAuthClientException $e) {
$msg = sprintf('OAuth client cURL error - code: %1s, msg: %2s',
$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);
@@ -147,7 +147,7 @@ class TwitterauthorizationAction extends Action
// token we sent them
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 {
@@ -167,7 +167,7 @@ class TwitterauthorizationAction extends Action
} catch (OAuthClientException $e) {
$msg = sprintf('OAuth client cURL error - code: %1$s, msg: %2$s',
$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
@@ -214,7 +214,7 @@ class TwitterauthorizationAction extends Action
if (empty($flink_id)) {
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);

View File

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