From a631fe29f3950f8db1f7fb4ce1f47261a9b0feff Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 8 Jan 2009 17:13:06 +0000 Subject: 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. --- modules/akismet/controllers/admin_akismet.php | 8 ++-- modules/akismet/helpers/akismet.php | 8 ++-- modules/akismet/helpers/akismet_menu.php | 4 +- modules/akismet/views/admin_akismet.html.php | 6 +-- modules/atom/libraries/Gallery_Atom_Link.php | 4 +- modules/comment/controllers/admin_comments.php | 27 +++++++------ modules/comment/helpers/comment.php | 24 ++++++------ modules/comment/helpers/comment_block.php | 4 +- modules/comment/helpers/comment_menu.php | 4 +- .../views/admin_block_recent_comments.html.php | 5 ++- modules/comment/views/admin_comments.html.php | 31 ++++++++------- modules/comment/views/comment.html.php | 4 +- modules/comment/views/comments.html.php | 4 +- modules/gmaps/helpers/gmaps_block.php | 2 +- modules/info/helpers/info_block.php | 6 +-- modules/info/views/info_block.html.php | 8 ++-- modules/media_rss/controllers/media_rss.php | 2 +- modules/search/views/search_link.html.php | 4 +- modules/slideshow/helpers/slideshow_menu.php | 4 +- modules/tag/controllers/admin_tags.php | 10 +++-- modules/tag/helpers/tag.php | 18 ++++----- modules/tag/helpers/tag_block.php | 2 +- modules/tag/helpers/tag_menu.php | 2 +- modules/tag/views/admin_tags.html.php | 20 +++++----- modules/user/controllers/admin_groups.php | 15 ++++---- modules/user/controllers/admin_users.php | 15 ++++---- modules/user/controllers/login.php | 14 +++---- modules/user/controllers/logout.php | 2 +- modules/user/helpers/group.php | 20 +++++----- modules/user/helpers/user.php | 44 +++++++++++----------- modules/user/helpers/user_menu.php | 6 +-- modules/user/views/admin_groups.html.php | 12 +++--- modules/user/views/admin_users.html.php | 12 +++--- modules/user/views/login.html.php | 10 ++--- modules/watermark/controllers/admin_watermarks.php | 14 +++---- modules/watermark/helpers/watermark.php | 40 ++++++++++---------- modules/watermark/helpers/watermark_menu.php | 2 +- modules/watermark/views/admin_watermarks.html.php | 24 ++++++------ 38 files changed, 228 insertions(+), 213 deletions(-) (limited to 'modules') diff --git a/modules/akismet/controllers/admin_akismet.php b/modules/akismet/controllers/admin_akismet.php index 6d32868f..487c68ce 100644 --- a/modules/akismet/controllers/admin_akismet.php +++ b/modules/akismet/controllers/admin_akismet.php @@ -35,14 +35,14 @@ class Admin_Akismet_Controller extends Admin_Controller { if ($valid) { $old_key = module::get_var("akismet", "api_key"); if ($old_key && !$new_key) { - message::success(_("Your Akismet key has been cleared.")); + message::success(t("Your Akismet key has been cleared.")); } else if ($old_key && $new_key && $old_key != $new_key) { - message::success(_("Your Akismet key has been changed.")); + message::success(t("Your Akismet key has been changed.")); } else if (!$old_key && $new_key) { - message::success(_("Your Akismet key has been saved.")); + message::success(t("Your Akismet key has been saved.")); } - log::success("akismet", _("Akismet key changed to $new_key")); + log::success("akismet", t("Akismet key changed to $new_key")); module::set_var("akismet", "api_key", $new_key); url::redirect("admin/akismet"); } else { diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index 12d7a106..df4e7cfe 100644 --- a/modules/akismet/helpers/akismet.php +++ b/modules/akismet/helpers/akismet.php @@ -30,10 +30,10 @@ class akismet_Core { public static function get_configure_form() { $form = new Forge("admin/akismet", "", "post"); - $group = $form->group("configure_akismet")->label(_("Configure Akismet")); - $group->input("api_key")->label(_("API Key"))->value(module::get_var("akismet", "api_key")); - $group->api_key->error_messages("invalid", _("The API key you provided is invalid.")); - $group->submit(_("Save")); + $group = $form->group("configure_akismet")->label(t("Configure Akismet")); + $group->input("api_key")->label(t("API Key"))->value(module::get_var("akismet", "api_key")); + $group->api_key->error_messages("invalid", t("The API key you provided is invalid.")); + $group->submit(t("Save")); return $form; } diff --git a/modules/akismet/helpers/akismet_menu.php b/modules/akismet/helpers/akismet_menu.php index 4a0c9b11..00bea8ad 100644 --- a/modules/akismet/helpers/akismet_menu.php +++ b/modules/akismet/helpers/akismet_menu.php @@ -22,14 +22,14 @@ class akismet_menu_Core { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("akismet") - ->label(_("Akismet")) + ->label(t("Akismet")) ->url(url::site("admin/akismet"))); if (module::get_var("akismet", "api_key")) { $menu->get("statistics_menu") ->append(Menu::factory("link") ->id("akismet") - ->label(_("Akismet")) + ->label(t("Akismet")) ->url(url::site("admin/akismet/stats"))); } } diff --git a/modules/akismet/views/admin_akismet.html.php b/modules/akismet/views/admin_akismet.html.php index 34a5461b..9963f223 100644 --- a/modules/akismet/views/admin_akismet.html.php +++ b/modules/akismet/views/admin_akismet.html.php @@ -1,13 +1,13 @@
-

+

- Wordpress.com API Key, which is also free. Your comments will be automatically relayed to Akismet.com where they'll be scanned for spam. Spam messages will be flagged accordingly and hidden from your vistors until you approve or delete them.") ?> + Wordpress.com API Key, which is also free. Your comments will be automatically relayed to Akismet.com where they'll be scanned for spam. Spam messages will be flagged accordingly and hidden from your vistors until you approve or delete them.") ?>

- +
diff --git a/modules/atom/libraries/Gallery_Atom_Link.php b/modules/atom/libraries/Gallery_Atom_Link.php index 07e3e891..def0d497 100644 --- a/modules/atom/libraries/Gallery_Atom_Link.php +++ b/modules/atom/libraries/Gallery_Atom_Link.php @@ -21,7 +21,7 @@ class Gallery_Atom_Link_Core extends Atom_Link { public function related_atom($relative_uri, $title="") { if (empty($title)) { - $title = _("Get related meta data"); + $title = t("Get related meta data"); } $this->rel("related") @@ -33,7 +33,7 @@ class Gallery_Atom_Link_Core extends Atom_Link { public function related_image($relative_uri, $title="", $image_type="jpeg") { if (empty($title)) { - $title = _("Get related image"); + $title = t("Get related image"); } $this->rel("related") diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index 7c88c1d9..9d7e1222 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -33,42 +33,47 @@ class Admin_Comments_Controller extends Admin_Controller { $view->content->menu = Menu::factory("root") ->append(Menu::factory("link") ->id("all") - ->label(sprintf(_("All Comments (%d)"), - $view->content->all->count())) + ->label(t(array("one" => "All Comments ({{count}})", + "other" => "All Comments ({{count}})"), + array("count" => $view->content->all->count()))) ->url(url::site("admin/comments/queue/all"))) ->append(Menu::factory("link") ->id("unpublished") - ->label(sprintf(_("Awaiting Moderation (%d)"), - $view->content->unpublished->count())) + ->label(t(array("one" => "Awaiting Moderation ({{count}})", + "other" => "Awaiting Moderation ({{count}})"), + array("count" => $view->content->unpublished->count()))) ->url(url::site("admin/comments/queue/unpublished"))) ->append(Menu::factory("link") ->id("published") - ->label(sprintf(_("Approved (%d)"), - $view->content->published->count())) + ->label(t(array("one" => "Approved ({{count}})", + "other" => "Approved ({{count}})"), + array("count" => $view->content->published->count()))) ->url(url::site("admin/comments/queue/published"))) ->append(Menu::factory("link") ->id("spam") - ->label(sprintf(_("Spam (%d)"), $view->content->spam->count())) + ->label(t(array("one" => "Spam ({{count}})", + "other" => "Spam ({{count}})"), + array("count" => $view->content->spam->count()))) ->url(url::site("admin/comments/queue/spam"))); switch ($state) { case "all": $view->content->comments = $view->content->all; - $view->content->title = _("All Comments"); + $view->content->title = t("All Comments"); break; case "published": $view->content->comments = $view->content->published; - $view->content->title = _("Approved Comments"); + $view->content->title = t("Approved Comments"); break; case "unpublished": $view->content->comments = $view->content->unpublished; - $view->content->title = _("Comments Awaiting Moderation"); + $view->content->title = t("Comments Awaiting Moderation"); break; case "spam": - $view->content->title = _("Spam Comments"); + $view->content->title = t("Spam Comments"); $view->content->comments = $view->content->spam; $view->content->spam_caught = module::get_var("comment", "spam_caught"); break; diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 4bc77e57..3b6c0240 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -100,25 +100,25 @@ class comment_Core { static function get_add_form($item) { $form = new Forge("comments", "", "post"); - $group = $form->group("add_comment")->label(_("Add comment")); - $group->input("author") ->label(_("Author")) ->id("gAuthor"); - $group->input("email") ->label(_("Email")) ->id("gEmail"); - $group->input("url") ->label(_("Website (hidden)"))->id("gUrl"); - $group->textarea("text") ->label(_("Text")) ->id("gText"); + $group = $form->group("add_comment")->label(t("Add comment")); + $group->input("author") ->label(t("Author")) ->id("gAuthor"); + $group->input("email") ->label(t("Email")) ->id("gEmail"); + $group->input("url") ->label(t("Website (hidden)"))->id("gUrl"); + $group->textarea("text") ->label(t("Text")) ->id("gText"); $group->hidden("item_id")->value($item->id); - $group->submit(_("Add")); + $group->submit(t("Add")); $form->add_rules_from(ORM::factory("comment")); return $form; } static function get_edit_form($comment) { $form = new Forge("comments/{$comment->id}?_method=put", "", "post"); - $group = $form->group("edit_comment")->label(_("Edit comment")); - $group->input("author") ->label(_("Author")) ->id("gAuthor")->value($comment->author); - $group->input("email") ->label(_("Email")) ->id("gEmail") ->value($comment->email); - $group->input("url") ->label(_("Website (hidden)"))->id("gUrl") ->value($comment->url); - $group->textarea("text")->label(_("Text")) ->id("gText") ->value($comment->text); - $group->submit(_("Edit")); + $group = $form->group("edit_comment")->label(t("Edit comment")); + $group->input("author") ->label(t("Author")) ->id("gAuthor")->value($comment->author); + $group->input("email") ->label(t("Email")) ->id("gEmail") ->value($comment->email); + $group->input("url") ->label(t("Website (hidden)"))->id("gUrl") ->value($comment->url); + $group->textarea("text")->label(t("Text")) ->id("gText") ->value($comment->text); + $group->submit(t("Edit")); $form->add_rules_from($comment); return $form; } diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php index 9a104baf..837eebb9 100644 --- a/modules/comment/helpers/comment_block.php +++ b/modules/comment/helpers/comment_block.php @@ -27,7 +27,7 @@ class comment_block_Core { public static function photo_bottom($theme) { $block = new Block; $block->id = "gComments"; - $block->title = _("Comments"); + $block->title = t("Comments"); $view = new View("comments.html"); $view->comments = ORM::factory("comment") @@ -44,7 +44,7 @@ class comment_block_Core { public static function admin_dashboard_blocks($theme) { $block = new Block(); $block->id = "gRecentComments"; - $block->title = _("Recent Comments"); + $block->title = t("Recent Comments"); $block->content = new View("admin_block_recent_comments.html"); $block->content->comments = ORM::factory("comment")->orderby("created", "DESC")->limit(5)->find_all(); diff --git a/modules/comment/helpers/comment_menu.php b/modules/comment/helpers/comment_menu.php index 9c7a5698..9df3024a 100644 --- a/modules/comment/helpers/comment_menu.php +++ b/modules/comment/helpers/comment_menu.php @@ -22,7 +22,7 @@ class comment_menu_Core { $menu->get("content_menu") ->append(Menu::factory("link") ->id("comments") - ->label(_("Comments")) + ->label(t("Comments")) ->url(url::site("admin/comments"))); } @@ -30,7 +30,7 @@ class comment_menu_Core { $menu ->append(Menu::factory("link") ->id("comments") - ->label(_("View comments on this item")) + ->label(t("View comments on this item")) ->url("#comments") ->css_id("gCommentsLink")); } diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index 6829d74b..2d753bd7 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -3,8 +3,9 @@
  • created) ?> - $comment->author", - "\"" . text::limit_words($comment->text, 50) . "\""); ?> + "$comment->author", + "comment_text" => "\"" . text::limit_words($comment->text, 50) . "\"")); ?>
  • diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index b1f0aa97..b9f5148b 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -16,7 +16,7 @@
    -

    +

    @@ -33,18 +33,22 @@

    - + "Gallery has caught {{count}} spam for you since you installed spam filtering.", + "other" => "Gallery has caught {{count}} spam for you since you installed spam filtering."), + array("count" => $spam_caught)) ?>

    count()): ?> - count()) ?> + "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.", + "other" => "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."), + array("count" => $spam->count())) ?>

    - + - +

    @@ -58,13 +62,13 @@ @@ -89,7 +93,8 @@ thumb_width, $item->thumb_height, 75) ?> /> - %s"), $item->url(), $item->title) ?> + sprintf("%s", $item->url(), $item->title))) ?>
    - + - + - +
    @@ -100,7 +105,7 @@ state != "unpublished"): ?>
  • - +
  • @@ -108,7 +113,7 @@ state != "published"): ?>
  • - +
  • @@ -116,14 +121,14 @@ state != "spam"): ?>
  • - +
  • - +
  • diff --git a/modules/comment/views/comment.html.php b/modules/comment/views/comment.html.php index a87634e9..de0640bd 100644 --- a/modules/comment/views/comment.html.php +++ b/modules/comment/views/comment.html.php @@ -6,8 +6,8 @@

    <?= $comment->author ?> - created) ?> - author ?> + created) ?> + author ?>

    text ?> diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index e34446ac..b28a536e 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -9,8 +9,8 @@

    <?= $comment->author ?> - created) ?> - author ?> + created) ?> + author ?>

    text ?> diff --git a/modules/gmaps/helpers/gmaps_block.php b/modules/gmaps/helpers/gmaps_block.php index dc58a4cd..04d0ae63 100644 --- a/modules/gmaps/helpers/gmaps_block.php +++ b/modules/gmaps/helpers/gmaps_block.php @@ -23,7 +23,7 @@ class gmaps_block_Core { if ($theme->item()) { $block = new Block(); $block->id = "gMaps"; - $block->title = _("Location"); + $block->title = t("Location"); $block->content = new View("gmaps_block.html"); return $block; } diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 422e62da..358dd3b8 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -22,7 +22,7 @@ class info_block_Core { if ($theme->item()) { $block = new Block(); $block->id = "gMetadata"; - $block->title = _("Item Info"); + $block->title = t("Item Info"); $block->content = new View("info_block.html"); return $block; } @@ -32,12 +32,12 @@ class info_block_Core { $results = ""; if ($item->view_count) { $results .= "
  • "; - $results .= sprintf(_("Views: %d"), $item->view_count); + $results .= t("Views: {{view_count}}", array("view_count" => $item->view_count)); $results .= "
  • "; } if ($item->owner) { $results .= "
  • "; - $results .= sprintf(_("By: %s"), "{$item->owner->name}"); + $results .= t("By: {{owner_name}}", array("owner_name" => "{$item->owner->name}")); $results .= "
  • "; } return $results; diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index f2c30395..491d9d10 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -2,22 +2,22 @@ - + - + id != 1): ?> - + owner): ?> - + diff --git a/modules/media_rss/controllers/media_rss.php b/modules/media_rss/controllers/media_rss.php index d10a9bc9..fbc3a29b 100644 --- a/modules/media_rss/controllers/media_rss.php +++ b/modules/media_rss/controllers/media_rss.php @@ -85,7 +85,7 @@ class Media_RSS_Controller extends Controller { $view = new View("feed.mrss"); $view->title = $tag->name; $view->link = url::abs_site("tags/{$tag->id}"); - $view->description = sprintf(_("Photos related to %s"), $tag->name); + $view->description = t("Photos related to {{tag_name}}", array("tag_name" => $tag->name)); $view->feed_link = url::abs_site("media_rss/tags/{$tag->id}"); $view->children = $children; diff --git a/modules/search/views/search_link.html.php b/modules/search/views/search_link.html.php index 5451638e..d5a5c47b 100644 --- a/modules/search/views/search_link.html.php +++ b/modules/search/views/search_link.html.php @@ -2,11 +2,11 @@
    • - +
    • - " /> + " />
    diff --git a/modules/slideshow/helpers/slideshow_menu.php b/modules/slideshow/helpers/slideshow_menu.php index 269239da..8cc0d7fe 100644 --- a/modules/slideshow/helpers/slideshow_menu.php +++ b/modules/slideshow/helpers/slideshow_menu.php @@ -22,7 +22,7 @@ class slideshow_menu_Core { $menu ->append(Menu::factory("link") ->id("slideshow") - ->label(_("View slideshow")) + ->label(t("View slideshow")) ->url("javascript:PicLensLite.start()") ->css_id("gSlideshowLink")); } @@ -31,7 +31,7 @@ class slideshow_menu_Core { $menu ->append(Menu::factory("link") ->id("slideshow") - ->label(_("View slideshow")) + ->label(t("View slideshow")) ->url("javascript:PicLensLite.start()") ->css_id("gSlideshowLink")); } 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 @@ -

    +

    ">
    - + - "/> + "/>
    - - - + + + @@ -25,14 +25,14 @@ diff --git a/modules/user/controllers/admin_groups.php b/modules/user/controllers/admin_groups.php index 01500f96..d05558a9 100644 --- a/modules/user/controllers/admin_groups.php +++ b/modules/user/controllers/admin_groups.php @@ -40,10 +40,10 @@ class Admin_Groups_Controller extends Controller { if ($valid) { $group = group::create($new_name); $group->save(); - message::success(sprintf(_("Created group %s"), $group->name)); + message::success(t("Created group {{group_name}}", array("group_name" => $group->name))); print json_encode(array("result" => "success")); } else { - message::error(_("Failed to create group")); + message::error(t("Failed to create group")); print json_encode(array("result" => "error", "form" => $form->__toString())); } @@ -64,13 +64,14 @@ class Admin_Groups_Controller extends Controller { $name = $group->name; $group->delete(); } else { - message::error(_("Failed to delete group")); + message::error(t("Failed to delete group")); print json_encode(array("result" => "error", "form" => $form->__toString())); } - log::success("group", sprintf(_("Deleted group %s"), $name)); - message::success(sprintf(_("Deleted group %s"), $name)); + $message = t("Deleted group {{group_name}}", array("group_name" => $name)); + log::success("group", $message); + message::success($message); print json_encode(array("result" => "success")); } @@ -103,10 +104,10 @@ class Admin_Groups_Controller extends Controller { if ($valid) { $group->name = $form->edit_group->inputs["name"]->value; $group->save(); - message::success(sprintf(_("Changed group %s"), $group->name)); + message::success(t("Changed group {{group_name}}", array("group_name" => $group->name))); print json_encode(array("result" => "success")); } else { - message::error(sprintf(_("Failed to change group %s"), $group->name)); + message::error(t("Failed to change group {{group_name}}", array("group_name" => $group->name))); print json_encode(array("result" => "error", "form" => $form->__toString())); } diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index 13115178..e936cb8a 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -41,10 +41,10 @@ class Admin_Users_Controller extends Controller { $name, $form->add_user->full_name->value, $form->add_user->password->value); $user->email = $form->add_user->email->value; $user->save(); - message::success(sprintf(_("Created user %s"), $user->name)); + message::success(t("Created user {{user_name}}", array("user_name" => $user->name))); print json_encode(array("result" => "success")); } else { - message::error(_("Failed to create user")); + message::error(t("Failed to create user")); print json_encode(array("result" => "error", "form" => $form->__toString())); } @@ -65,13 +65,14 @@ class Admin_Users_Controller extends Controller { $name = $user->name; $user->delete(); } else { - message::error(_("Failed to delete user")); + message::error(t("Failed to delete user")); print json_encode(array("result" => "error", "form" => $form->__toString())); } - log::success("user", sprintf(_("Deleted user %s"), $name)); - message::success(sprintf(_("Deleted user %s"), $name)); + $message = t("Deleted user {{user_name}}", array("user_name" => $name)); + log::success("user", $message); + message::success($message); print json_encode(array("result" => "success")); } @@ -107,10 +108,10 @@ class Admin_Users_Controller extends Controller { $user->password = $form->edit_user->password->value; $user->email = $form->edit_user->email->value; $user->save(); - message::success(sprintf(_("Changed user %s"), $user->name)); + message::success(t("Changed user {{user_name}}", array("user_name" => $user->name))); print json_encode(array("result" => "success")); } else { - message::error(sprintf(_("Failed to change user %s"), $user->name)); + message::error(t("Failed to change user {{user_name}}", array("user_name" => $user->name))); print json_encode(array("result" => "error", "form" => $form->__toString())); } diff --git a/modules/user/controllers/login.php b/modules/user/controllers/login.php index d5791eab..b3ab5b10 100644 --- a/modules/user/controllers/login.php +++ b/modules/user/controllers/login.php @@ -34,7 +34,7 @@ class Login_Controller extends Controller { $user = ORM::factory("user")->where("name", $form->login->inputs["name"]->value)->find(); if (!$user->loaded || !user::is_correct_password($user, $form->login->password->value)) { log::warning( - "user", sprintf(_("Failed login for %s"), $form->login->inputs["name"]->value)); + "user", t("Failed login for {{name}}", array("username" => $form->login->inputs["name"]->value))); $form->login->inputs["name"]->add_error("invalid_login", 1); $valid = false; } @@ -42,7 +42,7 @@ class Login_Controller extends Controller { if ($valid) { user::login($user); - log::info("user", sprintf(_("User %s logged in"), $user->name)); + log::info("user", t("User {{name}} logged in", array("name" => $user->name))); print json_encode( array("result" => "success")); } else { @@ -54,11 +54,11 @@ class Login_Controller extends Controller { private function _login_form() { $form = new Forge(url::current(true), "", "post", array("id" => "gLoginForm")); - $group = $form->group("login")->label(_("Login")); - $group->input("name")->label(_("Name"))->id("gName")->class(null); - $group->password("password")->label(_("Password"))->id("gPassword")->class(null); - $group->inputs["name"]->error_messages("invalid_login", _("Invalid name or password")); - $group->submit(_("Login")); + $group = $form->group("login")->label(t("Login")); + $group->input("name")->label(t("Name"))->id("gName")->class(null); + $group->password("password")->label(t("Password"))->id("gPassword")->class(null); + $group->inputs["name"]->error_messages("invalid_login", t("Invalid name or password")); + $group->submit(t("Login")); return $form; } } \ No newline at end of file diff --git a/modules/user/controllers/logout.php b/modules/user/controllers/logout.php index e0da9a9f..06b869be 100644 --- a/modules/user/controllers/logout.php +++ b/modules/user/controllers/logout.php @@ -21,7 +21,7 @@ class Logout_Controller extends Controller { public function index() { $user = user::active(); user::logout(); - log::info("user", sprintf(_("User %s logged out"), $user->name), + log::info("user", t("User {{name}} logged out", array("name" => $user->name)), html::anchor("user/$user->id", $user->name)); if ($this->input->get("continue")) { url::redirect($this->input->get("continue")); diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php index bd00d91e..41f19a7d 100644 --- a/modules/user/helpers/group.php +++ b/modules/user/helpers/group.php @@ -63,22 +63,22 @@ class group_Core { public static function get_edit_form_admin($group) { $form = new Forge("admin/groups/edit/$group->id"); - $form_group = $form->group("edit_group")->label(_("Edit Group")); - $form_group->input("name")->label(_("Name"))->id("gName")->value($group->name); + $form_group = $form->group("edit_group")->label(t("Edit Group")); + $form_group->input("name")->label(t("Name"))->id("gName")->value($group->name); $form_group->inputs["name"]->error_messages( - "in_use", _("There is already a group with that name")); - $form_group->submit(_("Save")); + "in_use", t("There is already a group with that name")); + $form_group->submit(t("Save")); $form->add_rules_from($group); return $form; } public static function get_add_form_admin() { $form = new Forge("admin/groups/add"); - $form_group = $form->group("add_group")->label(_("Add Group")); - $form_group->input("name")->label(_("Name"))->id("gName"); + $form_group = $form->group("add_group")->label(t("Add Group")); + $form_group->input("name")->label(t("Name"))->id("gName"); $form_group->inputs["name"]->error_messages( - "in_use", _("There is already a group with that name")); - $form_group->submit(_("Add Group")); + "in_use", t("There is already a group with that name")); + $form_group->submit(t("Add Group")); $group = ORM::factory("group"); $form->add_rules_from($group); return $form; @@ -87,8 +87,8 @@ class group_Core { public static function get_delete_form_admin($group) { $form = new Forge("admin/groups/delete/$group->id", "", "post"); $form_group = $form->group("delete_group")->label( - sprintf(_("Are you sure you want to delete group %s?"), $group->name)); - $form_group->submit(_("Delete")); + t("Are you sure you want to delete group {{group_name}}?", array("group_name" => $group->name))); + $form_group->submit(t("Delete")); return $form; } } diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index 3d8816e7..cc70d874 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -26,40 +26,40 @@ class user_Core { public static function get_edit_form($user, $action = NULL) { $form = new Forge("users/$user->id?_method=put", "", "post", array("id" => "gUserForm")); - $group = $form->group("edit_user")->label(_("Edit User")); - $group->input("name")->label(_("Name"))->id("gName")->value($user->name); - $group->input("full_name")->label(_("Full Name"))->id("gFullName")->value($user->full_name); - $group->password("password")->label(_("Password"))->id("gPassword"); - $group->input("email")->label(_("Email"))->id("gEmail")->value($user->email); - $group->submit(_("Save")); + $group = $form->group("edit_user")->label(t("Edit User")); + $group->input("name")->label(t("Name"))->id("gName")->value($user->name); + $group->input("full_name")->label(t("Full Name"))->id("gFullName")->value($user->full_name); + $group->password("password")->label(t("Password"))->id("gPassword"); + $group->input("email")->label(t("Email"))->id("gEmail")->value($user->email); + $group->submit(t("Save")); $form->add_rules_from($user); return $form; } public static function get_edit_form_admin($user) { $form = new Forge("admin/users/edit/$user->id"); - $group = $form->group("edit_user")->label(_("Edit User")); - $group->input("name")->label(_("Name"))->id("gName")->value($user->name); + $group = $form->group("edit_user")->label(t("Edit User")); + $group->input("name")->label(t("Name"))->id("gName")->value($user->name); $group->inputs["name"]->error_messages( - "in_use", _("There is already a user with that name")); - $group->input("full_name")->label(_("Full Name"))->id("gFullName")->value($user->full_name); - $group->password("password")->label(_("Password"))->id("gPassword"); - $group->input("email")->label(_("Email"))->id("gEmail")->value($user->email); - $group->submit(_("Modify User")); + "in_use", t("There is already a user with that name")); + $group->input("full_name")->label(t("Full Name"))->id("gFullName")->value($user->full_name); + $group->password("password")->label(t("Password"))->id("gPassword"); + $group->input("email")->label(t("Email"))->id("gEmail")->value($user->email); + $group->submit(t("Modify User")); $form->add_rules_from($user); return $form; } public static function get_add_form_admin() { $form = new Forge("admin/users/add"); - $group = $form->group("add_user")->label(_("Add User")); - $group->input("name")->label(_("Name"))->id("gName"); + $group = $form->group("add_user")->label(t("Add User")); + $group->input("name")->label(t("Name"))->id("gName"); $group->inputs["name"]->error_messages( - "in_use", _("There is already a user with that name")); - $group->input("full_name")->label(_("Full Name"))->id("gFullName"); - $group->password("password")->label(_("Password"))->id("gPassword"); - $group->input("email")->label(_("Email"))->id("gEmail"); - $group->submit(_("Add User")); + "in_use", t("There is already a user with that name")); + $group->input("full_name")->label(t("Full Name"))->id("gFullName"); + $group->password("password")->label(t("Password"))->id("gPassword"); + $group->input("email")->label(t("Email"))->id("gEmail"); + $group->submit(t("Add User")); $user = ORM::factory("user"); $form->add_rules_from($user); return $form; @@ -68,8 +68,8 @@ class user_Core { public static function get_delete_form_admin($user) { $form = new Forge("admin/users/delete/$user->id", "", "post"); $group = $form->group("delete_user")->label( - sprintf(_("Are you sure you want to delete user %s?"), $user->name)); - $group->submit(sprintf(_("Delete user %s"), $user->name)); + t("Are you sure you want to delete user {{name}}?", array("name" => $user->name))); + $group->submit(t("Delete user {{name}}", array("name" => $user->name))); return $form; } diff --git a/modules/user/helpers/user_menu.php b/modules/user/helpers/user_menu.php index 713e47bb..bdbe411b 100644 --- a/modules/user/helpers/user_menu.php +++ b/modules/user/helpers/user_menu.php @@ -22,15 +22,15 @@ class user_menu_Core { $menu->get("users_groups_menu") ->append(Menu::factory("link") ->id("list_users") - ->label(_("Users")) + ->label(t("Users")) ->url(url::site("admin/users"))) ->append(Menu::factory("link") ->id("list_groups") - ->label(_("Groups")) + ->label(t("Groups")) ->url(url::site("admin/groups"))) ->append(Menu::factory("link") ->id("users_groups") - ->label(_("Users <-> Groups")) + ->label(t("Users <-> Groups")) ->url("#")); } } diff --git a/modules/user/views/admin_groups.html.php b/modules/user/views/admin_groups.html.php index 5b5066dc..9547e121 100644 --- a/modules/user/views/admin_groups.html.php +++ b/modules/user/views/admin_groups.html.php @@ -1,24 +1,24 @@
    -

    +

    -

    +

      $group): ?>
    • name ?> "> + title=""> special): ?> name) ?>"> - + title=" $group->name)) ?>"> +
    • ">
    • + title="">
    diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index c31588d9..3d1c311f 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -1,22 +1,22 @@
    -

    +

    -

    +

      $user): ?>
    • name ?> last_login == 0) ? "" : "(" . date("M j, Y", $user->last_login) . ")" ?> - + id == $user->id || user::guest()->id == $user->id)): ?> - +
    • -
    • "> -
    • +
    • "> +
    diff --git a/modules/user/views/login.html.php b/modules/user/views/login.html.php index b73bea07..fd9bd773 100644 --- a/modules/user/views/login.html.php +++ b/modules/user/views/login.html.php @@ -2,13 +2,13 @@ diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index 6d552dae..54ee71b5 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -44,8 +44,8 @@ class Admin_Watermarks_Controller extends Admin_Controller { module::set_var("watermark", "transparency", $form->edit_watermark->transparency->value); $this->_update_graphics_rules(); - log::success("watermark", _("Watermark changed")); - message::success(_("Watermark changed")); + log::success("watermark", t("Watermark changed")); + message::success(t("Watermark changed")); print json_encode( array("result" => "success", "location" => url::site("admin/watermarks"))); @@ -73,8 +73,8 @@ class Admin_Watermarks_Controller extends Admin_Controller { module::clear_var("watermark", "position"); $this->_update_graphics_rules(); - log::success("watermark", _("Watermark deleted")); - message::success(_("Watermark deleted")); + log::success("watermark", t("Watermark deleted")); + message::success(t("Watermark deleted")); } print json_encode( array("result" => "success", @@ -100,7 +100,7 @@ class Admin_Watermarks_Controller extends Admin_Controller { if (!($image_info = getimagesize($file)) || !in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) { - message::error(_("Unable to identify this image file")); + message::error(t("Unable to identify this image file")); @unlink($file); return; } @@ -115,8 +115,8 @@ class Admin_Watermarks_Controller extends Admin_Controller { $this->_update_graphics_rules(); @unlink($file); - message::success(_("Watermark saved")); - log::success("watermark", _("Watermark saved")); + message::success(t("Watermark saved")); + log::success("watermark", t("Watermark saved")); print json_encode( array("result" => "success", "location" => url::site("admin/watermarks"))); diff --git a/modules/watermark/helpers/watermark.php b/modules/watermark/helpers/watermark.php index 9474d4c7..649c041c 100644 --- a/modules/watermark/helpers/watermark.php +++ b/modules/watermark/helpers/watermark.php @@ -24,15 +24,15 @@ class watermark_Core { } $form = new Forge("admin/watermarks/add", "", "post"); - $group = $form->group("add_watermark")->label(_("Upload Watermark")); - $group->upload("file")->label(_("Watermark"))->rules("allow[jpg,png,gif]|size[1MB]|required"); - $group->dropdown("position")->label(_("Watermark Position")) + $group = $form->group("add_watermark")->label(t("Upload Watermark")); + $group->upload("file")->label(t("Watermark"))->rules("allow[jpg,png,gif]|size[1MB]|required"); + $group->dropdown("position")->label(t("Watermark Position")) ->options(self::positions()) ->selected("southeast"); - $group->dropdown("transparency")->label(_("Transparency Percent")) + $group->dropdown("transparency")->label(t("Transparency Percent")) ->options($range) ->selected(100); - $group->submit(_("Upload")); + $group->submit(t("Upload")); return $form; } @@ -42,34 +42,34 @@ class watermark_Core { } $form = new Forge("admin/watermarks/edit", "", "post"); - $group = $form->group("edit_watermark")->label(_("Edit Watermark")); - $group->dropdown("position")->label(_("Watermark Position")) + $group = $form->group("edit_watermark")->label(t("Edit Watermark")); + $group->dropdown("position")->label(t("Watermark Position")) ->options(self::positions()) ->selected(module::get_var("watermark", "position")); - $group->dropdown("transparency")->label(_("Transparency Percent")) + $group->dropdown("transparency")->label(t("Transparency Percent")) ->options($range) ->selected(module::get_var("watermark", "transparency")); - $group->submit(_("Save")); + $group->submit(t("Save")); return $form; } public static function get_delete_form() { $form = new Forge("admin/watermarks/delete", "", "post"); - $group = $form->group("delete_watermark")->label(_("Really delete Watermark?")); - $group->submit(_("Delete")); + $group = $form->group("delete_watermark")->label(t("Really delete Watermark?")); + $group->submit(t("Delete")); return $form; } public static function positions() { - return array("northwest" => _("Northwest"), - "north" => _("North"), - "northeast" => _("Northeast"), - "west" => _("West"), - "center" => _("Center"), - "east" => _("East"), - "southwest" => _("Southwest"), - "south" => _("South"), - "southeast" => _("Southeast")); + return array("northwest" => t("Northwest"), + "north" => t("North"), + "northeast" => t("Northeast"), + "west" => t("West"), + "center" => t("Center"), + "east" => t("East"), + "southwest" => t("Southwest"), + "south" => t("South"), + "southeast" => t("Southeast")); } public static function position($key) { diff --git a/modules/watermark/helpers/watermark_menu.php b/modules/watermark/helpers/watermark_menu.php index 06960513..f8a6d3b1 100644 --- a/modules/watermark/helpers/watermark_menu.php +++ b/modules/watermark/helpers/watermark_menu.php @@ -23,7 +23,7 @@ class watermark_menu_Core { ->append( Menu::factory("link") ->id("watermarks") - ->label(_("Watermarks")) + ->label(t("Watermarks")) ->url(url::site("admin/watermarks"))); } } diff --git a/modules/watermark/views/admin_watermarks.html.php b/modules/watermark/views/admin_watermarks.html.php index a41d4d3e..106d05ce 100644 --- a/modules/watermark/views/admin_watermarks.html.php +++ b/modules/watermark/views/admin_watermarks.html.php @@ -1,36 +1,36 @@
    -

    +

    - +

    " - title="" - class="gDialogLink"> + title="" + class="gDialogLink"> -

    +

    - +

    - + watermark::position($position))) ?>

    - + module::get_var("watermark", "transparency"))) ?>

    " - title="" - class="gDialogLink"> + title="" + class="gDialogLink"> " - title="" - class="gDialogLink"> + title="" + class="gDialogLink">
    -- cgit v1.2.3