From 055a5b3798d45c80f932032709d9d768d9205bde Mon Sep 17 00:00:00 2001 From: Remo Laubacher Date: Thu, 17 Apr 2014 22:13:06 +0200 Subject: [PATCH 1/2] strings moved to "lang" --- app/Controllers/BrowseController.php | 20 ++++++++++---------- app/Controllers/RemindersController.php | 2 +- app/Controllers/UserTricksController.php | 6 +++--- app/lang/en/browse.php | 18 ++++++++++++++++++ app/lang/en/home.php | 11 +++++++++++ app/lang/en/password.php | 8 ++++++++ app/lang/en/reminders.php | 2 ++ app/lang/en/search.php | 7 +++++++ app/lang/en/tricks.php | 5 +++++ app/lang/en/user.php | 7 +++++++ app/lang/en/user_tricks.php | 8 ++++++++ app/views/browse/categories.blade.php | 2 +- app/views/browse/tags.blade.php | 2 +- app/views/home/about.blade.php | 2 +- app/views/home/error.blade.php | 2 +- app/views/home/index.blade.php | 2 +- app/views/home/login.blade.php | 2 +- app/views/home/register.blade.php | 2 +- app/views/password/remind.blade.php | 2 +- app/views/password/reset.blade.php | 2 +- app/views/search/result.blade.php | 2 +- app/views/tricks/edit.blade.php | 2 +- app/views/tricks/new.blade.php | 2 +- app/views/user/favorites.blade.php | 2 +- app/views/user/profile.blade.php | 2 +- app/views/user/settings.blade.php | 2 +- 26 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 app/lang/en/browse.php create mode 100644 app/lang/en/home.php create mode 100644 app/lang/en/password.php create mode 100644 app/lang/en/search.php create mode 100644 app/lang/en/tricks.php create mode 100644 app/lang/en/user.php create mode 100644 app/lang/en/user_tricks.php diff --git a/app/Controllers/BrowseController.php b/app/Controllers/BrowseController.php index dba5ba0..b41a4ac 100644 --- a/app/Controllers/BrowseController.php +++ b/app/Controllers/BrowseController.php @@ -71,8 +71,8 @@ public function getBrowseCategory($category) { list($category, $tricks) = $this->tricks->findByCategory($category); - $type = 'Category "'.$category->name.'"'; - $pageTitle = 'Browsing Category "' . $category->name . '"'; + $type = \Lang::get('browse.category', array('category' => $category->name)); + $pageTitle = \Lang::get('browse.browsing_category', array('category' => $category->name)); $this->view('browse.index', compact('tricks', 'type', 'pageTitle')); } @@ -99,8 +99,8 @@ public function getBrowseTag($tag) { list($tag, $tricks) = $this->tricks->findByTag($tag); - $type = 'Tag "'.$tag->name.'"'; - $pageTitle = 'Browsing Tag "' . $tag->name . '"'; + $type = \Lang::get('browse.tag', array('tag' => $tag->name)); + $pageTitle = \Lang::get('browse.browsing_tag', array('tag' => $tag->name)); $this->view('browse.index', compact('tricks', 'type', 'pageTitle')); } @@ -114,8 +114,8 @@ public function getBrowseRecent() { $tricks = $this->tricks->findMostRecent(); - $type = 'Recent'; - $pageTitle = 'Browsing Most Recent Laravel Tricks'; + $type = \Lang::get('browse.recent'); + $pageTitle = \Lang::get('browse.browsing_most_recent_tricks'); $this->view('browse.index', compact('tricks', 'type', 'pageTitle')); } @@ -129,8 +129,8 @@ public function getBrowsePopular() { $tricks = $this->tricks->findMostPopular(); - $type = 'Popular'; - $pageTitle = 'Browsing Most Popular Laravel Tricks'; + $type = \Lang::get('browse.popular'); + $pageTitle = \Lang::get('browse.browsing_most_popular_tricks'); $this->view('browse.index', compact('tricks', 'type', 'pageTitle')); } @@ -144,8 +144,8 @@ public function getBrowseComments() { $tricks = $this->tricks->findMostCommented(); - $type = 'Most commented'; - $pageTitle = 'Browsing Most Commented Laravel Tricks'; + $type = \Lang::get('browse.most_commented'); + $pageTitle = \Lang::get('browse.browsing_most_commented_tricks'); $this->view('browse.index', compact('tricks', 'type', 'pageTitle')); } diff --git a/app/Controllers/RemindersController.php b/app/Controllers/RemindersController.php index 957ae14..b10b1bb 100644 --- a/app/Controllers/RemindersController.php +++ b/app/Controllers/RemindersController.php @@ -29,7 +29,7 @@ public function getRemind() public function postRemind() { $result = Password::remind(Input::only('email'), function ($message, $user) { - $message->subject('Your Password Reminder for Laravel Tricks'); + $message->subject(\Lang::get('reminders.your_password_reminder')); }); switch ($result) { diff --git a/app/Controllers/UserTricksController.php b/app/Controllers/UserTricksController.php index ecd7fad..978066b 100644 --- a/app/Controllers/UserTricksController.php +++ b/app/Controllers/UserTricksController.php @@ -132,7 +132,7 @@ public function postEdit($slug) $trick = $this->trick->edit($trick, $data); return $this->redirectRoute('tricks.edit', [ $trick->slug ], [ - 'success' => 'Trick has been updated' + 'success' => \Lang::get('user_tricks.trick_updated') ]); } @@ -147,7 +147,7 @@ public function getDelete($slug) $trick = $this->trick->findBySlug($slug); if ($trick->user_id != Auth::user()->id) { - return "This trick doesn't belong to you"; + return \Lang::get('user_tricks.trick_does_not_belong_to_you'); } $trick->tags()->detach(); @@ -155,7 +155,7 @@ public function getDelete($slug) $trick->delete(); return $this->redirectRoute('user.index', null, [ - 'success' => 'Trick has been deleted' + 'success' => \Lang::get('user_tricks.trick_deleted') ]); } } diff --git a/app/lang/en/browse.php b/app/lang/en/browse.php new file mode 100644 index 0000000..6b8010c --- /dev/null +++ b/app/lang/en/browse.php @@ -0,0 +1,18 @@ + ':title | Laravel-Tricks.com', + 'browsing_most_recent_tricks' => 'Browsing Most Recent Laravel Tricks', + 'browsing_most_popular_tricks' => 'Browsing Most Popular Laravel Tricks', + 'browsing_tag' => 'Browsing Tag ":tag"', + 'tag' => 'Tag ":tag"', + 'tags' => 'Tags', + 'category' => 'Category ":category"', + 'categories' => 'Categories', + 'recent' => 'Recent', + 'popular' => 'Popular', + 'most_commented' => 'Most commented', + 'browsing_most_commented_tricks' => 'Browsing Most Commented Laravel Tricks', + 'browsing_category' => 'Browsing Category ":category"', + +); \ No newline at end of file diff --git a/app/lang/en/home.php b/app/lang/en/home.php new file mode 100644 index 0000000..b26ca29 --- /dev/null +++ b/app/lang/en/home.php @@ -0,0 +1,11 @@ + 'About Laravel-Tricks website', + 'error' => 'Error', + 'welcome' => 'Welcome', + 'login' => 'Login', + 'registration' => 'Registration', + +); + diff --git a/app/lang/en/password.php b/app/lang/en/password.php new file mode 100644 index 0000000..2fd27dd --- /dev/null +++ b/app/lang/en/password.php @@ -0,0 +1,8 @@ + 'Reset password', + 'resetting_password' => 'Resetting password', + +); + diff --git a/app/lang/en/reminders.php b/app/lang/en/reminders.php index b35b56e..71514a1 100644 --- a/app/lang/en/reminders.php +++ b/app/lang/en/reminders.php @@ -20,5 +20,7 @@ "token" => "This password reset token is invalid.", "sent" => "Password reminder sent!", + + "your_password_reminder" => "Your Password Reminder for Laravel Tricks", ); diff --git a/app/lang/en/search.php b/app/lang/en/search.php new file mode 100644 index 0000000..233f7ed --- /dev/null +++ b/app/lang/en/search.php @@ -0,0 +1,7 @@ + 'Search results for ":term"', + +); + diff --git a/app/lang/en/tricks.php b/app/lang/en/tricks.php new file mode 100644 index 0000000..3ef8011 --- /dev/null +++ b/app/lang/en/tricks.php @@ -0,0 +1,5 @@ + 'Trick', +); \ No newline at end of file diff --git a/app/lang/en/user.php b/app/lang/en/user.php new file mode 100644 index 0000000..1596258 --- /dev/null +++ b/app/lang/en/user.php @@ -0,0 +1,7 @@ + 'My Favorites', + 'profile' => 'Profile', + 'settings' => 'Settings', +); \ No newline at end of file diff --git a/app/lang/en/user_tricks.php b/app/lang/en/user_tricks.php new file mode 100644 index 0000000..167aa78 --- /dev/null +++ b/app/lang/en/user_tricks.php @@ -0,0 +1,8 @@ + 'Trick has been updated', + 'trick_deleted' => 'Trick has been deleted', + 'trick_does_not_belong_to_you' => 'This trick doesn\'t belong to you', + +); \ No newline at end of file diff --git a/app/views/browse/categories.blade.php b/app/views/browse/categories.blade.php index 6c4e0ae..2f0b310 100644 --- a/app/views/browse/categories.blade.php +++ b/app/views/browse/categories.blade.php @@ -1,4 +1,4 @@ -@section('title', 'Categories') +@section('title', trans('browse.categories')) @section('content')
diff --git a/app/views/browse/tags.blade.php b/app/views/browse/tags.blade.php index 5179b2a..f0f7de4 100644 --- a/app/views/browse/tags.blade.php +++ b/app/views/browse/tags.blade.php @@ -1,4 +1,4 @@ -@section('title', 'Tags') +@section('title', trans('browse.tags')) @section('content')
diff --git a/app/views/home/about.blade.php b/app/views/home/about.blade.php index ef5f1bd..f3bc448 100644 --- a/app/views/home/about.blade.php +++ b/app/views/home/about.blade.php @@ -1,4 +1,4 @@ -@section('title','About Laravel-Tricks website') +@section('title', trans('home.about_tricks_website')) @section('content')
diff --git a/app/views/home/error.blade.php b/app/views/home/error.blade.php index f264660..2d6a66c 100644 --- a/app/views/home/error.blade.php +++ b/app/views/home/error.blade.php @@ -1,6 +1,6 @@ @extends('layouts.main') -@section('title','Error') +@section('title', trans('home.error')) @section('content')
diff --git a/app/views/home/index.blade.php b/app/views/home/index.blade.php index c7629b5..b8d7e8e 100644 --- a/app/views/home/index.blade.php +++ b/app/views/home/index.blade.php @@ -1,4 +1,4 @@ -@section('title','Welcome') +@section('title', trans('home.welcome')) @section('content')
diff --git a/app/views/home/login.blade.php b/app/views/home/login.blade.php index a3943ec..b3fa6f5 100644 --- a/app/views/home/login.blade.php +++ b/app/views/home/login.blade.php @@ -1,4 +1,4 @@ -@section('title', 'Login') +@section('title', trans('home.login')) @section('content')
diff --git a/app/views/home/register.blade.php b/app/views/home/register.blade.php index 685bc6e..4e820b4 100644 --- a/app/views/home/register.blade.php +++ b/app/views/home/register.blade.php @@ -1,4 +1,4 @@ -@section('title', 'Registration') +@section('title', trans('home.registration')) @section('content')
diff --git a/app/views/password/remind.blade.php b/app/views/password/remind.blade.php index edafd4f..26dbf93 100644 --- a/app/views/password/remind.blade.php +++ b/app/views/password/remind.blade.php @@ -1,4 +1,4 @@ -@section('title', 'Reset password') +@section('title', trans('password.reset_password')) @section('content')
diff --git a/app/views/password/reset.blade.php b/app/views/password/reset.blade.php index 63cbb54..88036a0 100644 --- a/app/views/password/reset.blade.php +++ b/app/views/password/reset.blade.php @@ -1,4 +1,4 @@ -@section('title', 'Resetting password') +@section('title', trans('password.resetting_password')) @section('content')
diff --git a/app/views/search/result.blade.php b/app/views/search/result.blade.php index fbd029e..9b0917d 100644 --- a/app/views/search/result.blade.php +++ b/app/views/search/result.blade.php @@ -1,4 +1,4 @@ -@section('title','Search results for "'.$term.'"') +@section('title', trans('search.search_results_for', array('term' => $term))) @section('scripts')