summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorzach <zach@controlyourself.ca>2008-08-18 20:29:03 -0400
committerzach <zach@controlyourself.ca>2008-08-18 20:29:03 -0400
commitd57bc1b8e99a432d7f6425d0c8836a3c4928581a (patch)
tree199dcc3c641aaef424563bda2c2d25acf93f21ef /actions
parentc2a2da69667c2c18e26aabe757bd13ee6283b251 (diff)
Twitter-compatible API - running all strings through gettext() now
darcs-hash:20080819002903-462f3-94e62891db9b9de049a918034742e545f663e840.gz
Diffstat (limited to 'actions')
-rw-r--r--actions/twitapiaccount.php13
-rw-r--r--actions/twitapiblocks.php4
-rw-r--r--actions/twitapidirect_messages.php8
-rw-r--r--actions/twitapifavorites.php6
-rw-r--r--actions/twitapifriendships.php6
-rw-r--r--actions/twitapihelp.php4
-rw-r--r--actions/twitapinotifications.php4
-rw-r--r--actions/twitapistatuses.php18
-rw-r--r--actions/twitapiusers.php4
9 files changed, 34 insertions, 33 deletions
diff --git a/actions/twitapiaccount.php b/actions/twitapiaccount.php
index 0a57ad91c..716ddd154 100644
--- a/actions/twitapiaccount.php
+++ b/actions/twitapiaccount.php
@@ -46,7 +46,7 @@ class TwitapiaccountAction extends TwitterapiAction {
header('Content-Type: application/json; charset=utf-8');
print '{"authorized":true}';
} else {
- common_user_error("API method not found!", $code=404);
+ common_user_error(_('API method not found!'), $code=404);
}
exit();
@@ -54,7 +54,7 @@ class TwitapiaccountAction extends TwitterapiAction {
function end_session($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
@@ -65,9 +65,8 @@ class TwitapiaccountAction extends TwitterapiAction {
if (!is_null($location) && strlen($location) > 255) {
- // XXX: But Twitter just truncates and runs with it. -- Zach
- header('HTTP/1.1 406 Not Acceptable');
- print "That's too long. Max notice size is 255 chars.\n";
+ // XXX: But Twitter just truncates and runs with it. -- Zach
+ $this->client_error(_('That\'s too long. Max notice size is 255 chars.'), 406, $apidate['content-type']);
exit();
}
@@ -106,13 +105,13 @@ class TwitapiaccountAction extends TwitterapiAction {
function update_delivery_device($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function rate_limit_status($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
} \ No newline at end of file
diff --git a/actions/twitapiblocks.php b/actions/twitapiblocks.php
index a498d2038..0fdbba199 100644
--- a/actions/twitapiblocks.php
+++ b/actions/twitapiblocks.php
@@ -25,13 +25,13 @@ class TwitapiblocksAction extends TwitterapiAction {
function create($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function destroy($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php
index 9a84082e6..aad055fbf 100644
--- a/actions/twitapidirect_messages.php
+++ b/actions/twitapidirect_messages.php
@@ -40,26 +40,26 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
function direct_messages($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function sent($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
# had to change this from "new" to "create" to avoid PHP reserved word
function create($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function destroy($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php
index 4de567603..b5380bd94 100644
--- a/actions/twitapifavorites.php
+++ b/actions/twitapifavorites.php
@@ -38,19 +38,19 @@ class TwitapifavoritesAction extends TwitterapiAction {
function favorites($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function create($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function destroy($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index 05c192ea6..ae15d171e 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -52,7 +52,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$user = $apidata['user'];
if ($user->isSubscribed($other)) {
- $this->client_error("Could not follow user: $other->nickname is already on your list.", 403, $apidata['content-type']);
+ $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
+ $this->client_error($errmsg, 403, $apidata['content-type']);
exit();
}
@@ -67,7 +68,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$result = $sub->insert();
if (!$result) {
- $this->client_error("Could not follow user: $other->nickname.", 400, $apidata['content-type']);
+ $errmsg = sprintf(_('Could not follow user: %s is already on your list.'), $other->nickname);
+ $this->client_error($errmsg, 400, $apidata['content-type']);
exit();
}
diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php
index 7695190fc..2ac4178de 100644
--- a/actions/twitapihelp.php
+++ b/actions/twitapihelp.php
@@ -42,14 +42,14 @@ class TwitapihelpAction extends TwitterapiAction {
print '"ok"';
$this->end_document('json');
} else {
- common_user_error("API method not found!", $code=404);
+ common_user_error(_('API method not found!'), $code=404);
}
exit();
}
function downtime_schedule($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php
index 95fe550b1..9e3cc15c4 100644
--- a/actions/twitapinotifications.php
+++ b/actions/twitapinotifications.php
@@ -26,13 +26,13 @@ class TwitapinotificationsAction extends TwitterapiAction {
function follow($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
function leave($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
exit();
}
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 92c6fbb63..6a63dd037 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -82,12 +82,12 @@ class TwitapistatusesAction extends TwitterapiAction {
$this->show_json_timeline($notice);
break;
default:
- common_user_error("API method not found!", $code = 404);
+ common_user_error(_('API method not found!'), $code = 404);
break;
}
} else {
- common_server_error('Couldn\'t find any statuses.', $code = 503);
+ common_server_error(_('Couldn\'t find any statuses.'), $code = 503);
}
exit();
@@ -253,7 +253,7 @@ class TwitapistatusesAction extends TwitterapiAction {
$this->show_json_timeline($notice);
break;
default:
- common_user_error("API method not found!", $code = 404);
+ common_user_error(_('API method not found!'), $code = 404);
}
exit();
@@ -364,7 +364,7 @@ class TwitapistatusesAction extends TwitterapiAction {
$this->show_json_timeline($notice);
break;
default:
- common_user_error("API method not found!", $code = 404);
+ common_user_error(_('API method not found!'), $code = 404);
}
exit();
@@ -397,7 +397,7 @@ class TwitapistatusesAction extends TwitterapiAction {
// as "truncated." Sending this error may screw up some clients
// that assume Twitter will truncate for them. Should we just
// truncate too? -- Zach
- $this->client_error('That\'s too long. Max notice size is 140 chars.', $code = 406, $apidata['content-type']);
+ $this->client_error(_('That\'s too long. Max notice size is 140 chars.'), $code = 406, $apidata['content-type']);
exit();
}
@@ -411,7 +411,7 @@ class TwitapistatusesAction extends TwitterapiAction {
if ($reply) {
$reply_to = $in_reply_to_status_id;
} else {
- $this->client_error('Not found', $code = 404, $apidata['content-type']);
+ $this->client_error(_('Not found'), $code = 404, $apidata['content-type']);
exit();
}
}
@@ -521,7 +521,7 @@ class TwitapistatusesAction extends TwitterapiAction {
$this->show_json_timeline($notices);
break;
default:
- common_user_error("API method not found!", $code = 404);
+ common_user_error(_('API method not found!'), $code = 404);
}
@@ -548,6 +548,7 @@ class TwitapistatusesAction extends TwitterapiAction {
*/
function destroy($args, $apidata) {
+
parent::handle($args);
common_server_error("API method under construction.", $code=501);
}
@@ -702,7 +703,7 @@ class TwitapistatusesAction extends TwitterapiAction {
*/
function featured($args, $apidata) {
parent::handle($args);
- common_server_error("API method under construction.", $code=501);
+ common_server_error(_('API method under construction.'), $code=501);
}
function get_user($id, $apidata) {
@@ -716,4 +717,3 @@ class TwitapistatusesAction extends TwitterapiAction {
}
}
-
diff --git a/actions/twitapiusers.php b/actions/twitapiusers.php
index d66dc8863..233de3c21 100644
--- a/actions/twitapiusers.php
+++ b/actions/twitapiusers.php
@@ -72,7 +72,7 @@ class TwitapiusersAction extends TwitterapiAction {
if (!$user) {
// XXX: Twitter returns a random(?) user instead of throwing and err! -- Zach
- $this->client_error("User not found.", 404, $apidata['content-type']);
+ $this->client_error(_('User not found.'), 404, $apidata['content-type']);
exit();
}
@@ -119,7 +119,7 @@ class TwitapiusersAction extends TwitterapiAction {
$this->show_twitter_json_users($twitter_user);
$this->end_document('json');
} else {
- common_user_error("API method not found!", $code = 404);
+ common_user_error(_('API method not found!'), $code = 404);
}
exit();