diff options
author | Andy Staudacher <andy.st@gmail.com> | 2009-01-08 17:13:06 +0000 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2009-01-08 17:13:06 +0000 |
commit | a631fe29f3950f8db1f7fb4ce1f47261a9b0feff (patch) | |
tree | b5af3ad39362dea97ce01be63d5ec09b7846bb9c /modules/tag | |
parent | fd081159f1783918d81e355e25e262ccc5249913 (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 'modules/tag')
-rw-r--r-- | modules/tag/controllers/admin_tags.php | 10 | ||||
-rw-r--r-- | modules/tag/helpers/tag.php | 18 | ||||
-rw-r--r-- | modules/tag/helpers/tag_block.php | 2 | ||||
-rw-r--r-- | modules/tag/helpers/tag_menu.php | 2 | ||||
-rw-r--r-- | modules/tag/views/admin_tags.html.php | 20 |
5 files changed, 27 insertions, 25 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 7370fb42..b30f5b95 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -52,8 +52,8 @@ class Admin_Tags_Controller extends Admin_Controller { $name = $tag->name; Database::instance()->query("DELETE from `items_tags` where `tag_id` = $tag->id"); $tag->delete(); - message::success(sprintf(_("Deleted tag %s"), $name)); - log::success("tags", sprintf(_("Deleted tag %s"), $name)); + message::success(t("Deleted tag {{tag_name}}", array("tag_name" => $name))); + log::success("tags", t("Deleted tag {{tag_name}}", array("tag_name" => $name))); print json_encode( array("result" => "success", @@ -96,8 +96,10 @@ class Admin_Tags_Controller extends Admin_Controller { $tag->name = $new_name; $tag->save(); - message::success(sprintf(_("Renamed tag %s to %s"), $old_name, $tag->name)); - log::success("tags", sprintf(_("Renamed tag %s to %s"), $old_name, $tag->name)); + $message = t("Renamed tag {{old_name}} to {{new_name}}", + array("old_name" => $old_name, "new_name" => $tag->name)); + message::success($message); + log::success("tags", $message); print json_encode( array("result" => "success", diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 43697165..f552c669 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -77,28 +77,28 @@ class tag_Core { public static function get_add_form($item) { $form = new Forge("tags", "", "post", array("id" => "gAddTagForm")); - $group = $form->group("add_tag")->label(_("Add Tag")); - $group->input("name")->label(_("Add tag")); + $group = $form->group("add_tag")->label(t("Add Tag")); + $group->input("name")->label(t("Add tag")); $group->hidden("item_id")->value($item->id); - $group->submit(_("Add Tag")); + $group->submit(t("Add Tag")); $form->add_rules_from(ORM::factory("tag")); return $form; } public static function get_rename_form($tag) { $form = new Forge("admin/tags/rename/$tag->id", "", "post", array("id" => "gRenameTagForm")); - $group = $form->group("rename_tag")->label(_("Rename Tag")); - $group->input("name")->label(_("Tag name"))->value($tag->name); - $group->inputs["name"]->error_messages("in_use", _("There is already a tag with that name")); - $group->submit(_("Save")); + $group = $form->group("rename_tag")->label(t("Rename Tag")); + $group->input("name")->label(t("Tag name"))->value($tag->name); + $group->inputs["name"]->error_messages("in_use", t("There is already a tag with that name")); + $group->submit(t("Save")); $form->add_rules_from(ORM::factory("tag")); return $form; } public static function get_delete_form($tag) { $form = new Forge("admin/tags/delete/$tag->id", "", "post", array("id" => "gDeleteTagForm")); - $group = $form->group("delete_tag")->label(sprintf(_("Really delete tag %s?"), $tag->name)); - $group->submit(_("Delete Tag")); + $group = $form->group("delete_tag")->label(t("Really delete tag {{tag_name}}?", array("tag_name" => $tag->name))); + $group->submit(t("Delete Tag")); $form->add_rules_from(ORM::factory("tag")); return $form; } diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index 37f7f21e..adcc7d40 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -26,7 +26,7 @@ class tag_block_Core { public static function sidebar_blocks($theme) { $block = new Block(); $block->id = "gTag"; - $block->title = _("Popular Tags"); + $block->title = t("Popular Tags"); $block->content = new View("tag_block.html"); $block->content->cloud = tag::cloud(30); diff --git a/modules/tag/helpers/tag_menu.php b/modules/tag/helpers/tag_menu.php index b13453f8..5fa53b34 100644 --- a/modules/tag/helpers/tag_menu.php +++ b/modules/tag/helpers/tag_menu.php @@ -22,7 +22,7 @@ class tag_menu_Core { $menu->get("content_menu") ->append(Menu::factory("link") ->id("tags") - ->label(_("Tags")) + ->label(t("Tags")) ->url(url::site("admin/tags"))); } } diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php index 4315917b..12f724b2 100644 --- a/modules/tag/views/admin_tags.html.php +++ b/modules/tag/views/admin_tags.html.php @@ -1,21 +1,21 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<h1> <?= _("Tags") ?> </h1> +<h1> <?= t("Tags") ?> </h1> <div id="gTagSearch"> <form method="get" action="<?= url::site("admin/tags") ?>"> <fieldset> - <legend> <?= _("Search Tags") ?> </legend> + <legend> <?= t("Search Tags") ?> </legend> <input name="filter" value="<?= $filter ?>"/> - <input type="submit" value="<?= _("Search Tags") ?>"/> + <input type="submit" value="<?= t("Search Tags") ?>"/> </fieldset> </form> </div> <table> <tr> - <th> <?= _("Tag") ?> </th> - <th> <?= _("Photos") ?> </th> - <th> <?= _("Actions") ?> </th> + <th> <?= t("Tag") ?> </th> + <th> <?= t("Photos") ?> </th> + <th> <?= t("Actions") ?> </th> </tr> <? foreach ($tags as $tag): ?> <tr> @@ -25,14 +25,14 @@ <ul> <li> <a href="<?= url::site("admin/tags/form_delete/$tag->id") ?>" class="gDialogLink" - title="<?= sprintf(_("Delete tag %s"), $tag->name) ?>"> - <?= _("delete") ?> + title="<?= t("Delete tag {{tag_name}}", array("tag_name" => $tag->name)) ?>"> + <?= t("delete") ?> </a> </li> <li> <a href="<?= url::site("admin/tags/form_rename/$tag->id") ?>" class="gDialogLink" - title="<?= sprintf(_("Rename tag %s"), $tag->name) ?>"> - <?= _("rename") ?> + title="<?= t("Rename tag {{tag_name}}", array("tag_name" => $tag->name)) ?>"> + <?= t("rename") ?> </a> </li> </ul> |