diff --git a/core/controllers/admin_dashboard.php b/core/controllers/admin_dashboard.php
index 43b61868..15701417 100644
--- a/core/controllers/admin_dashboard.php
+++ b/core/controllers/admin_dashboard.php
@@ -42,12 +42,12 @@ class Admin_Dashboard_Controller extends Admin_Controller {
if ($form->add_block->center->value) {
dashboard::add_block("main", $module_name, $block_id);
message::success(
- t("Added {{title}} block to the main dashboard area",
+ t("Added %title block to the main dashboard area",
array("title" => $available["$module_name:$id"])));
} else {
dashboard::add_block("sidebar", $module_name, $block_id);
message::success(
- t("Added {{title}} to the dashboard sidebar",
+ t("Added %title to the dashboard sidebar",
array("title" => $available["$module_name:$id"])));
}
}
@@ -68,7 +68,7 @@ class Admin_Dashboard_Controller extends Admin_Controller {
if (!empty($deleted)) {
$available = dashboard::get_available();
$title = $available[join(":", $deleted)];
- message::success(t("Removed {{title}} block", array("title" => $title)));
+ message::success(t("Removed %title block", array("title" => $title)));
}
url::redirect("admin");
diff --git a/core/controllers/admin_graphics.php b/core/controllers/admin_graphics.php
index 69a83575..fe71a222 100644
--- a/core/controllers/admin_graphics.php
+++ b/core/controllers/admin_graphics.php
@@ -50,7 +50,7 @@ class Admin_Graphics_Controller extends Admin_Controller {
site_status::clear("missing_graphics_toolkit");
message::success(t("Updated Graphics Toolkit"));
- log::success("graphics", t("Changed graphics toolkit to: {{toolkit}}",
+ log::success("graphics", t("Changed graphics toolkit to: %toolkit",
array("toolkit" => $toolkit)));
}
diff --git a/core/controllers/admin_maintenance.php b/core/controllers/admin_maintenance.php
index 1c9b4164..6b344243 100644
--- a/core/controllers/admin_maintenance.php
+++ b/core/controllers/admin_maintenance.php
@@ -31,7 +31,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
"description" => (
$dirty_count ?
t2("You have one image which is out of date",
- "You have {{count}} out-of-date images",
+ "You have %count out-of-date images",
$dirty_count)
: t("All your images are up to date")),
"severity" => $dirty_count ? log::WARNING : log::SUCCESS),
@@ -51,9 +51,9 @@ class Admin_Maintenance_Controller extends Admin_Controller {
if ($stalled_count) {
log::warning("tasks",
t2("One task is stalled",
- "{{count}} tasks are stalled",
+ "%count tasks are stalled",
$stalled_count),
- t("{{link_start}}view{{link_end}}",
+ t("%link_startview%link_end",
array("link_start" => "",
"link_start" => "")));
}
@@ -89,7 +89,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->csrf = access::csrf_token();
$view->task = $task;
- log::info("tasks", t("Task {{task_name}} started (task id {{task_id}})",
+ 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;
@@ -110,7 +110,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->csrf = access::csrf_token();
$view->task = $task;
- log::info("tasks", t("Task {{task_name}} resumed (task id {{task_id}})",
+ 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;
@@ -171,14 +171,14 @@ class Admin_Maintenance_Controller extends Admin_Controller {
if ($task->done) {
switch ($task->state) {
case "success":
- log::success("tasks", t("Task {{task_name}} completed (task id {{task_id}})",
+ 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", t("Task {{task_name}} failed (task id {{task_id}})",
+ 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"));
diff --git a/core/controllers/admin_modules.php b/core/controllers/admin_modules.php
index e345f8c6..2cd56c85 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(t("Uninstalled {{module_name}} module", array("module_name" => $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(t("Installed {{module_name}} module", array("module_name" => $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 b2e0b0e2..194b9d17 100644
--- a/core/controllers/admin_themes.php
+++ b/core/controllers/admin_themes.php
@@ -63,11 +63,11 @@ class Admin_Themes_Controller extends Admin_Controller {
if ($type == "admin" && $info->admin) {
module::set_var("core", "active_admin_theme", $theme_name);
- message::success(t("Successfully changed your admin theme to {{theme_name}}",
+ message::success(t("Successfully changed your admin theme to %theme_name",
array("theme_name" => $info->name)));
} else if ($type == "site" && $info->site) {
module::set_var("core", "active_site_theme", $theme_name);
- message::success(t("Successfully changed your Gallery theme to {{theme_name}}",
+ message::success(t("Successfully changed your Gallery theme to %theme_name",
array("theme_name" => $info->name)));
}
@@ -109,7 +109,7 @@ class Admin_Themes_Controller extends Admin_Controller {
if ($theme != module::get_var("core", "active_theme")) {
module::set_var("core", "active_theme", $theme);
message::success(t("Updated Theme"));
- log::success("graphics", t("Changed theme to {{theme_name}}", array("theme_name" => $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 0150314c..39946e60 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(t("Created album {{album_title}}", array("album_title" => $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(t("Added photo {{photo_title}}", array("photo_title" => $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("item_updated", $orig, $album);
log::success("content", "Updated album", "id\">view");
- message::success(t("Saved album {{album_title}}", array("album_title" => $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 ae1c6a3b..829f391f 100644
--- a/core/controllers/photos.php
+++ b/core/controllers/photos.php
@@ -81,7 +81,7 @@ class Photos_Controller extends Items_Controller {
module::event("item_updated", $orig, $photo);
log::success("content", "Updated photo", "id\">view");
- message::success(t("Saved photo {{photo_title}}", array("photo_title" => $photo->title)));
+ message::success(t("Saved photo %photo_title", array("photo_title" => $photo->title)));
print json_encode(
array("result" => "success",
diff --git a/core/helpers/album.php b/core/helpers/album.php
index e1875b3a..223a057d 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -65,7 +65,7 @@ class album_Core {
static function get_add_form($parent) {
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
- $group = $form->group("add_album")->label(t("Add Album to {{album_title}}", array("album_title" => $parent->title)));
+ $group = $form->group("add_album")->label(t("Add Album to %album_title", array("album_title" => $parent->title)));
$group->input("name")->label(t("Name"));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index 3ee67358..b8f50561 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -219,7 +219,7 @@ class core_installer {
}
if (!module::get_var("core", "graphics_toolkit")) {
site_status::warning(
- t("Graphics toolkit missing! Please {{link_start}}choose a toolkit{{link_start}}.",
+ t("Graphics toolkit missing! Please %link_startchoose a toolkit%link_start.",
array("link_start" => "", "link_end" => "")),
"missing_graphics_toolkit");
}
diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php
index 7b13c55d..2edfb5f8 100644
--- a/core/helpers/graphics.php
+++ b/core/helpers/graphics.php
@@ -217,8 +217,8 @@ class graphics_Core {
$count = self::find_dirty_images_query()->count();
if ($count) {
site_status::warning(
- t2("One of your photos is out of date. {{link_start}}Click here to fix it{{link_end}}",
- "{{count}} of your photos are out of date. {{link_start}}Click here to fix them{{link_end}}",
+ t2("One of your photos is out of date. %link_startClick here to fix it%link_end",
+ "%count of your photos are out of date. %link_startClick here to fix them%link_end",
$count,
array("link_start" => "status = t2("Updated: 1 image. Total: {{total_count}}.",
- "Updated: {{count}} images. Total: {{total_count}}.",
+ $task->status = t2("Updated: 1 image. Total: %total_count.",
+ "Updated: %count images. Total: %total_count.",
$completed,
array("total_count" => ($remaining + $completed)));
diff --git a/core/helpers/module.php b/core/helpers/module.php
index bded9dc6..b45f6c78 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -129,7 +129,7 @@ class module_Core {
}
self::load_modules();
- log::success("module", t("Installed module {{module_name}}", array("module_name" => $module_name)));
+ log::success("module", t("Installed module %module_name", array("module_name" => $module_name)));
}
/**
@@ -140,7 +140,7 @@ class module_Core {
$installer_class = "{$module_name}_installer";
Kohana::log("debug", "$installer_class uninstall");
call_user_func(array($installer_class, "uninstall"));
- log::success("module", t("Uninstalled module {{module_name}}", array("module_name" => $module_name)));
+ log::success("module", t("Uninstalled module %module_name", array("module_name" => $module_name)));
}
/**
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index 74ef02e0..a2958aec 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -97,7 +97,7 @@ class photo_Core {
static function get_add_form($parent) {
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddPhotoForm"));
- $group = $form->group("add_photo")->label(t("Add Photo to {{album_title}}", array("album_title" =>$parent->title)));
+ $group = $form->group("add_photo")->label(t("Add Photo to %album_title", array("album_title" =>$parent->title)));
$group->input("name")->label(t("Name"));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
diff --git a/core/libraries/I18n.php b/core/libraries/I18n.php
index 0aa6652b..04176b75 100644
--- a/core/libraries/I18n.php
+++ b/core/libraries/I18n.php
@@ -68,7 +68,7 @@ class I18n_Core {
/**
* Translates a localizable message.
* @param $message String|array The message to be translated. E.g. "Hello world"
- * or array("one" => "One album", "other" => "{{count}} albums")
+ * or array("one" => "One album", "other" => "%count albums")
* @param $options array (optional) Options array for key value pairs which are used
* for pluralization and interpolation. Special keys are "count" and "locale",
* the latter to override the currently configured locale.
@@ -118,9 +118,13 @@ class I18n_Core {
private function interpolate($locale, $string, $values) {
// TODO: Handle locale specific number formatting.
+
+ // Replace x_y before replacing x.
+ krsort($values, SORT_STRING);
+
$keys = array();
foreach (array_keys($values) as $key) {
- $keys[] = "{{" . $key . "}}";
+ $keys[] = "%$key";
}
return str_replace($keys, array_values($values), $string);
}
diff --git a/core/tests/I18n_Test.php b/core/tests/I18n_Test.php
index f99dd9c1..e621c0e3 100644
--- a/core/tests/I18n_Test.php
+++ b/core/tests/I18n_Test.php
@@ -34,10 +34,10 @@ class I18n_Test extends Unit_Test_Case {
$messages_de_DE = array(
array('Hello world', 'Hallo Welt'),
array(array('one' => 'One item has been added',
- 'other' => '{{count}} elements have been added'),
+ 'other' => '%count elements have been added'),
array('one' => 'Ein Element wurde hinzugefuegt.',
- 'other' => '{{count}} Elemente wurden hinzugefuegt.')),
- array('Hello {{name}}, how are you today?', 'Hallo {{name}}, wie geht es Dir heute?'));
+ 'other' => '%count Elemente wurden hinzugefuegt.')),
+ array('Hello %name, how are you today?', 'Hallo %name, wie geht es Dir heute?'));
foreach ($messages_de_DE as $data) {
list ($message, $translation) = $data;
@@ -65,25 +65,25 @@ class I18n_Test extends Unit_Test_Case {
public function translate_plural_other_test() {
$result = $this->i18n->translate(array('one' => 'One item has been added',
- 'other' => '{{count}} items have been added.'),
+ 'other' => '%count items have been added.'),
array('count' => 5));
$this->assert_equal('5 Elemente wurden hinzugefuegt.', $result);
}
public function translate_plural_one_test() {
$result = $this->i18n->translate(array('one' => 'One item has been added',
- 'other' => '{{count}} items have been added.'),
+ 'other' => '%count items have been added.'),
array('count' => 1));
$this->assert_equal('Ein Element wurde hinzugefuegt.', $result);
}
public function translate_interpolate_test() {
- $result = $this->i18n->translate('Hello {{name}}, how are you today?', array('name' => 'John'));
+ $result = $this->i18n->translate('Hello %name, how are you today?', array('name' => 'John'));
$this->assert_equal('Hallo John, wie geht es Dir heute?', $result);
}
public function translate_interpolate_missing_value_test() {
- $result = $this->i18n->translate('Hello {{name}}, how are you today?', array('foo' => 'bar'));
- $this->assert_equal('Hallo {{name}}, wie geht es Dir heute?', $result);
+ $result = $this->i18n->translate('Hello %name, how are you today?', array('foo' => 'bar'));
+ $this->assert_equal('Hallo %name, wie geht es Dir heute?', $result);
}
}
\ No newline at end of file
diff --git a/core/views/admin_block_platform.html.php b/core/views/admin_block_platform.html.php
index 2f13d5d9..09fc0515 100644
--- a/core/views/admin_block_platform.html.php
+++ b/core/views/admin_block_platform.html.php
@@ -1,15 +1,15 @@
diff --git a/core/views/admin_block_stats.html.php b/core/views/admin_block_stats.html.php
index 42f34aa4..2d975073 100644
--- a/core/views/admin_block_stats.html.php
+++ b/core/views/admin_block_stats.html.php
@@ -1,12 +1,12 @@
diff --git a/core/views/admin_block_welcome.html.php b/core/views/admin_block_welcome.html.php
index 35501ffc..89914fb3 100644
--- a/core/views/admin_block_welcome.html.php
+++ b/core/views/admin_block_welcome.html.php
@@ -4,15 +4,15 @@
- = t("The GD graphics library is an extension to PHP commonly installed most webservers. Please refer to the GD website for more information.", + = t("The GD graphics library is an extension to PHP commonly installed most webservers. Please refer to the GD website for more information.", array("url" => "http://www.boutell.com/gd")) ?>
if ($tk->gd["GD Version"] && function_exists('imagerotate')): ?>- = t("You have GD version {{version}}.", array("version" => $tk->gd["GD Version"])) ?> + = t("You have GD version %version.", array("version" => $tk->gd["GD Version"])) ?>
elseif ($tk->gd["GD Version"]): ?>- = t("You have GD version {{version}}, but it lacks image rotation.", + = t("You have GD version %version, but it lacks image rotation.", array("version" => $tk->gd["GD Version"])) ?>
else: ?> diff --git a/core/views/admin_graphics_graphicsmagick.html.php b/core/views/admin_graphics_graphicsmagick.html.php index 8dc1d714..bb4f906d 100644 --- a/core/views/admin_graphics_graphicsmagick.html.php +++ b/core/views/admin_graphics_graphicsmagick.html.php @@ -3,12 +3,12 @@- = t("GraphicsMagick is a standalone graphics program available on most Linux systems. Please refer to the GraphicsMagick website for more information.", + = t("GraphicsMagick is a standalone graphics program available on most Linux systems. Please refer to the GraphicsMagick website for more information.", array("url" => "http://www.graphicsmagick.org")) ?>
if ($tk->graphicsmagick): ?>- = t("GraphicsMagick is available in {{path}}", array("path" => $tk->graphicsmagick)) ?> + = t("GraphicsMagick is available in %path", array("path" => $tk->graphicsmagick)) ?>
else: ?>diff --git a/core/views/admin_graphics_imagemagick.html.php b/core/views/admin_graphics_imagemagick.html.php index 02a18ac8..7898a8d1 100644 --- a/core/views/admin_graphics_imagemagick.html.php +++ b/core/views/admin_graphics_imagemagick.html.php @@ -3,12 +3,12 @@
- = t("ImageMagick is a standalone graphics program available on most Linux systems. Please refer to the ImageMagick website for more information.", + = t("ImageMagick is a standalone graphics program available on most Linux systems. Please refer to the ImageMagick website for more information.", array("url" => "http://www.imagemagick.org")) ?>
if ($tk->imagemagick): ?>- = t("ImageMagick is available in {{path}}", array("path" => $tk->imagemagick)) ?> + = t("ImageMagick is available in %path", array("path" => $tk->imagemagick)) ?>
else: ?>diff --git a/core/views/admin_maintenance.html.php b/core/views/admin_maintenance.html.php index 1da87788..fd5f7a58 100644 --- a/core/views/admin_maintenance.html.php +++ b/core/views/admin_maintenance.html.php @@ -75,7 +75,7 @@ elseif ($task->state == "stalled"): ?> = t("Stalled") ?> else: ?> - = t("{{percent_complete}}% Complete", array("percent_complete" => $task->percent_complete)) ?> + = t("%percent_complete% Complete", array("percent_complete" => $task->percent_complete)) ?> endif ?>
- = t2("Gallery has caught {{count}} spam for you since you installed spam filtering.", - "Gallery has caught {{count}} spam for you since you installed spam filtering.", + = t2("Gallery has caught %count spam for you since you installed spam filtering.", + "Gallery has caught %count spam for you since you installed spam filtering.", $spam_caught) ?>
endif ?>if ($spam->count()): ?> = t2("There is currently one comment in your spam queue. You can delete it with a single click, but there is no undo operation so you may want to check the message first to make sure that it really is spam.", - "There are currently {{count}} comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.", + "There are currently %count comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.", $spam->count()) ?>
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index 111b12bd..ec7530c4 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -11,7 +11,7 @@ width="40" height="40" /> - = t("on {{date}} {{name}} said", + = t("on %date %name said", array("date" => date("Y-M-d H:i:s", $comment->created), "name" => $comment->author_name())); ?>
diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 3bc51c73..c832b4f6 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -32,12 +32,12 @@ class info_block_Core { $results = ""; if ($item->view_count) { $results .= "- = t("Position: {{position}}", array("position" => watermark::position($position))) ?> + = t("Position: %position", array("position" => watermark::position($position))) ?>
- = t("Transparency: {{transparency}}%", array("transparency" => module::get_var("watermark", "transparency"))) ?> + = t("Transparency: %transparency%", array("transparency" => module::get_var("watermark", "transparency"))) ?>