summaryrefslogtreecommitdiff
path: root/core/controllers
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-01-08 17:13:06 +0000
committerAndy Staudacher <andy.st@gmail.com>2009-01-08 17:13:06 +0000
commita631fe29f3950f8db1f7fb4ce1f47261a9b0feff (patch)
treeb5af3ad39362dea97ce01be63d5ec09b7846bb9c /core/controllers
parentfd081159f1783918d81e355e25e262ccc5249913 (diff)
i18n refactoring: Rename all _() (reserved by gettext) calls to t().
- And refactor printf to our string interpolation / pluralization syntax - Also, a slight change to the translations_incomings table, using binary(16) instead of char(32) as message key.
Diffstat (limited to 'core/controllers')
-rw-r--r--core/controllers/admin_graphics.php4
-rw-r--r--core/controllers/admin_maintenance.php47
-rw-r--r--core/controllers/admin_modules.php4
-rw-r--r--core/controllers/admin_themes.php6
-rw-r--r--core/controllers/albums.php6
-rw-r--r--core/controllers/photos.php2
6 files changed, 38 insertions, 31 deletions
diff --git a/core/controllers/admin_graphics.php b/core/controllers/admin_graphics.php
index e6e42672..babad3d4 100644
--- a/core/controllers/admin_graphics.php
+++ b/core/controllers/admin_graphics.php
@@ -38,8 +38,8 @@ class Admin_Graphics_Controller extends Admin_Controller {
}
site_status::clear("missing_graphics_toolkit");
- message::success(_("Updated Graphics Toolkit"));
- log::success("graphics", sprintf(_("Changed graphics toolkit to %s"), $toolkit));
+ message::success(t("Updated Graphics Toolkit"));
+ log::success("graphics", t("Changed graphics toolkit to: {{toolkit}}", array("toolkit" => $toolkit)));
}
url::redirect("admin/graphics");
diff --git a/core/controllers/admin_maintenance.php b/core/controllers/admin_maintenance.php
index ea844a1f..3eec16fc 100644
--- a/core/controllers/admin_maintenance.php
+++ b/core/controllers/admin_maintenance.php
@@ -26,13 +26,14 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$dirty_count = graphics::find_dirty_images_query()->count();
return array(
"graphics::rebuild_dirty_images" => new ArrayObject(
- array("name" => _("Rebuild Images"),
+ array("name" => t("Rebuild Images"),
"callback" => "graphics::rebuild_dirty_images",
"description" => (
$dirty_count ?
- sprintf(
- _("You have %d out-of-date images"), $dirty_count)
- : _("All your images are up to date")),
+ t(array("one" => "You have one image which is out of date",
+ "other" => "You have {{count}} out-of-date images"),
+ array("count" => $dirty_count))
+ : t("All your images are up to date")),
"severity" => $dirty_count ? log::WARNING : log::SUCCESS),
ArrayObject::ARRAY_AS_PROPS));
}
@@ -49,10 +50,12 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks",
- sprintf(_("%d tasks are stalled"), $stalled_count),
- sprintf(_("%sview%s"),
- "<a href=\"" . url::site("admin/maintenance") . "\">",
- "</a>"));
+ t(array("one" => "One task is stalled",
+ "other" => "{{count}} tasks are stalled"),
+ array("count" => $stalled_count)),
+ t("{{link_start}}view{{link_end}}",
+ array("link_start" => "<a href=\"" . url::site("admin/maintenance") . "\">",
+ "link_start" => "</a>")));
}
$view = new Admin_View("admin.html");
@@ -86,8 +89,9 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->csrf = access::csrf_token();
$view->task = $task;
- log::info("tasks", sprintf(_("Task %s started (task id %d)"), $task->name, $task->id),
- html::anchor(url::site("admin/maintenance"), _("maintenance")));
+ log::info("tasks", t("Task {{task_name}} started (task id {{task_id}})",
+ array("task_name" => $task->name, "task_id" => $task->id)),
+ html::anchor(url::site("admin/maintenance"), t("maintenance")));
print $view;
}
@@ -106,8 +110,9 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->csrf = access::csrf_token();
$view->task = $task;
- log::info("tasks", sprintf(_("Task %s resumed (task id %d)"), $task->name, $task->id),
- html::anchor(url::site("admin/maintenance"), _("maintenance")));
+ log::info("tasks", t("Task {{task_name}} resumed (task id {{task_id}})",
+ array("task_name" => $task->name, "task_id" => $task->id)),
+ html::anchor(url::site("admin/maintenance"), t("maintenance")));
print $view;
}
@@ -126,7 +131,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$task->state = "cancelled";
$task->save();
- message::success(_("Task cancelled"));
+ message::success(t("Task cancelled"));
url::redirect("admin/maintenance");
}
@@ -142,7 +147,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
throw new Exception("@todo MISSING_TASK");
}
$task->delete();
- message::success(_("Task removed"));
+ message::success(t("Task removed"));
url::redirect("admin/maintenance");
}
@@ -166,15 +171,17 @@ class Admin_Maintenance_Controller extends Admin_Controller {
if ($task->done) {
switch ($task->state) {
case "success":
- log::success("tasks", sprintf(_("Task %s completed (task id %d)"), $task->name, $task->id),
- html::anchor(url::site("admin/maintenance"), _("maintenance")));
- message::success(_("Task completed successfully"));
+ log::success("tasks", t("Task {{task_name}} completed (task id {{task_id}})",
+ array("task_name" => $task->name, "task_id" => $task->id)),
+ html::anchor(url::site("admin/maintenance"), t("maintenance")));
+ message::success(t("Task completed successfully"));
break;
case "error":
- log::error("tasks", sprintf(_("Task %s failed (task id %d)"), $task->name, $task->id),
- html::anchor(url::site("admin/maintenance"), _("maintenance")));
- message::success(_("Task failed"));
+ log::error("tasks", t("Task {{task_name}} failed (task id {{task_id}})",
+ array("task_name" => $task->name, "task_id" => $task->id)),
+ html::anchor(url::site("admin/maintenance"), t("maintenance")));
+ message::success(t("Task failed"));
break;
}
print json_encode(
diff --git a/core/controllers/admin_modules.php b/core/controllers/admin_modules.php
index c416a699..e345f8c6 100644
--- a/core/controllers/admin_modules.php
+++ b/core/controllers/admin_modules.php
@@ -34,10 +34,10 @@ class Admin_Modules_Controller extends Admin_Controller {
$desired = $this->input->post($module_name) == 1;
if ($info->installed && !$desired) {
module::uninstall($module_name);
- message::success(sprintf(_("Uninstalled %s module"), $info->name));
+ message::success(t("Uninstalled {{module_name}} module", array("module_name" => $info->name)));
} else if (!$info->installed && $desired) {
module::install($module_name);
- message::success(sprintf(_("Installed %s module"), $info->name));
+ message::success(t("Installed {{module_name}} module", array("module_name" => $info->name)));
}
}
url::redirect("admin/modules");
diff --git a/core/controllers/admin_themes.php b/core/controllers/admin_themes.php
index 5c9a2ad1..6641221f 100644
--- a/core/controllers/admin_themes.php
+++ b/core/controllers/admin_themes.php
@@ -26,14 +26,14 @@ class Admin_Themes_Controller extends Admin_Controller {
$view->content->active = module::get_var("core", "active_theme");
print $view;
}
-
+
public function save() {
access::verify_csrf();
$theme = $this->input->post("theme");
if ($theme != module::get_var("core", "active_theme")) {
module::set_var("core", "active_theme", $theme);
- message::success(_("Updated Theme"));
- log::success("graphics", sprintf(_("Changed theme to %s"), $theme));
+ message::success(t("Updated Theme"));
+ log::success("graphics", t("Changed theme to {{theme_name}}", array("theme_name" => $theme)));
}
url::redirect("admin/themes");
}
diff --git a/core/controllers/albums.php b/core/controllers/albums.php
index 20291315..d87bd640 100644
--- a/core/controllers/albums.php
+++ b/core/controllers/albums.php
@@ -93,7 +93,7 @@ class Albums_Controller extends Items_Controller {
log::success("content", "Created an album",
html::anchor("albums/$new_album->id", "view album"));
- message::success(sprintf(_("Created album %s"), $new_album->title));
+ message::success(t("Created album {{album_title}}", array("album_title" => $new_album->title)));
print json_encode(
array("result" => "success",
@@ -123,7 +123,7 @@ class Albums_Controller extends Items_Controller {
user::active()->id);
log::success("content", "Added a photo", html::anchor("photos/$photo->id", "view photo"));
- message::success(sprintf(_("Added photo %s"), $photo->title));
+ message::success(t("Added photo {{photo_title}}", array("photo_title" => $photo->title)));
print json_encode(
array("result" => "success",
@@ -155,7 +155,7 @@ class Albums_Controller extends Items_Controller {
module::event("album_changed", $orig, $album);
log::success("content", "Updated album", "<a href=\"albums/$album->id\">view</a>");
- message::success(sprintf(_("Saved album %s"), $album->title));
+ message::success(t("Saved album {{album_title}}", array("album_title" => $album->title)));
print json_encode(
array("result" => "success",
diff --git a/core/controllers/photos.php b/core/controllers/photos.php
index 6b5e84ba..b177b205 100644
--- a/core/controllers/photos.php
+++ b/core/controllers/photos.php
@@ -81,7 +81,7 @@ class Photos_Controller extends Items_Controller {
module::event("photo_changed", $orig, $photo);
log::success("content", "Updated photo", "<a href=\"photos/$photo->id\">view</a>");
- message::success(sprintf(_("Saved photo %s"), $photo->title));
+ message::success(t("Saved photo {{photo_title}}", array("photo_title" => $photo->title)));
print json_encode(
array("result" => "success",