Skip to content

Commit

Permalink
Merge pull request #50 from Remo/lang-dir
Browse files Browse the repository at this point in the history
strings moved to "lang"
  • Loading branch information
msurguy committed Apr 17, 2014
2 parents 7b4815c + 303fe44 commit d54fec7
Show file tree
Hide file tree
Showing 31 changed files with 144 additions and 78 deletions.
20 changes: 10 additions & 10 deletions app/Controllers/BrowseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand All @@ -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'));
}
Expand All @@ -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'));
}
Expand All @@ -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'));
}
Expand All @@ -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'));
}
Expand Down
2 changes: 1 addition & 1 deletion app/Controllers/RemindersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions app/Controllers/UserTricksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
]);
}

Expand All @@ -147,15 +147,15 @@ 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();
$trick->categories()->detach();
$trick->delete();

return $this->redirectRoute('user.index', null, [
'success' => 'Trick has been deleted'
'success' => \Lang::get('user_tricks.trick_deleted')
]);
}
}
18 changes: 18 additions & 0 deletions app/lang/en/browse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

return array(
'site_title' => ':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"',

);
11 changes: 11 additions & 0 deletions app/lang/en/home.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return array(
'about_tricks_website' => 'About Laravel-Tricks website',
'error' => 'Error',
'welcome' => 'Welcome',
'login' => 'Login',
'registration' => 'Registration',

);

8 changes: 8 additions & 0 deletions app/lang/en/password.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return array(
'reset_password' => 'Reset password',
'resetting_password' => 'Resetting password',

);

2 changes: 2 additions & 0 deletions app/lang/en/reminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
"token" => "This password reset token is invalid.",

"sent" => "Password reminder sent!",

"your_password_reminder" => "Your Password Reminder for Laravel Tricks",

);
7 changes: 7 additions & 0 deletions app/lang/en/search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

return array(
'search_results_for' => 'Search results for ":term"',

);

5 changes: 5 additions & 0 deletions app/lang/en/tricks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return array(
'trick' => 'Trick',
);
7 changes: 7 additions & 0 deletions app/lang/en/user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

return array(
'my_favorites' => 'My Favorites',
'profile' => 'Profile',
'settings' => 'Settings',
);
8 changes: 8 additions & 0 deletions app/lang/en/user_tricks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return array(
'trick_update' => 'Trick has been updated',
'trick_deleted' => 'Trick has been deleted',
'trick_does_not_belong_to_you' => 'This trick doesn\'t belong to you',

);
12 changes: 6 additions & 6 deletions app/views/admin/categories/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
@section('title','Editing category')
@section('title', trans('admin.editing_category'))

@section('content')
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="page-header">
<h1>Editing a category <a href="{{ url('admin/categories')}}" class="btn btn-lg btn-default pull-right">Cancel</a></h1>
<h1>{{ trans('admin.editing_a_category') }} <a href="{{ url('admin/categories')}}" class="btn btn-lg btn-default pull-right">{{ trans('admin.cancel') }}</a></h1>
</div>

@if($errors->all())
<div class="bs-callout bs-callout-danger">
<h4>Please fix the errors below:</h4>
<h4>{{ trans('admin.please_fix_errors') }}</h4>
{{ HTML::ul($errors->all())}}
</div>
@endif

{{ Form::model($category,array('class'=>'form-horizontal'))}}
<div class="form-group">
<label for="name" class="col-lg-2 control-label">Name</label>
<label for="name" class="col-lg-2 control-label">{{ trans('admin.name') }}</label>
<div class="col-lg-10">
{{ Form::text('name',null,array('class'=>'form-control'))}}
</div>
</div>
<div class="form-group">
<label for="description" class="col-lg-2 control-label">Description</label>
<label for="description" class="col-lg-2 control-label">{{ trans('admin.description') }}</label>
<div class="col-lg-10">
{{ Form::textarea('description',null,array('class'=>'form-control','rows'=>'5'))}}
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
{{ Form::submit('Save category',array('class'=>'btn btn-primary btn-block')); }}
{{ Form::submit( trans('admin.save_category') ,array('class'=>'btn btn-primary btn-block')); }}
</div>
</div>
{{ Form::close()}}
Expand Down
32 changes: 16 additions & 16 deletions app/views/admin/categories/list.blade.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
@section('title','Viewing categories')
@section('title', trans('admin.viewing_category'))

@section('content')
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="page-header">
<h1>Categories for Laravel tricks <span class="pull-right"> <a data-toggle="modal" href="#add_category" class="btn btn-primary btn-lg">Add new Category</a></span></h1>
<h1>{{ trans('admin.category_for_tricks') }} <span class="pull-right"> <a data-toggle="modal" href="#add_category" class="btn btn-primary btn-lg">{{ trans('admin.add_new_category') }}</a></span></h1>
</div>

<table class="table">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th># of Tricks</th>
<th class="col-lg-3 text-right">Actions</th>
<th>{{ trans('admin.title') }}</th>
<th>{{ trans('admin.description') }}</th>
<th>{{ trans('admin.num_of_tricks') }}</th>
<th class="col-lg-3 text-right">{{ trans('admin.actions') }}</th>
</tr>
</thead>
<tbody id="sortable">
Expand All @@ -26,8 +26,8 @@
<td>{{ $category->tricks->count()}}</td>
<td>
<div class="btn-group pull-right">
<a class="btn btn-primary btn-sm" href="{{url('admin/categories/view/'.$category->id)}}">Edit</a>
<a class="delete_toggler btn btn-danger btn-sm" rel="{{$category->id}}">Delete</a>
<a class="btn btn-primary btn-sm" href="{{url('admin/categories/view/'.$category->id)}}">{{ trans('admin.edit') }}</a>
<a class="delete_toggler btn btn-danger btn-sm" rel="{{$category->id}}">{{ trans('admin.delete') }}</a>
</div>
</td>
</tr>
Expand All @@ -44,24 +44,24 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Adding new category</h4>
<h4 class="modal-title">{{ trans('admin.adding_new_category') }}</h4>
</div>
<div class="modal-body">
@if($errors->all())
<div class="bs-callout bs-callout-danger">
<h4>Please fix the errors below:</h4>
<h4>{{ trans('admin.please_fix_errors') }}</h4>
{{ HTML::ul($errors->all())}}
</div>
@endif
{{ Form::open(array('class'=>'form-horizontal'))}}
<div class="form-group">
<label for="title" class="col-lg-2 control-label">Name</label>
<label for="title" class="col-lg-2 control-label">{{ trans('admin.name') }}</label>
<div class="col-lg-10">
{{ Form::text('name',null,array('class'=>'form-control'))}}
</div>
</div>
<div class="form-group">
<label for="url" class="col-lg-2 control-label">Description</label>
<label for="url" class="col-lg-2 control-label">{{ trans('admin.description') }}</label>
<div class="col-lg-10">
{{ Form::textarea('description',null,array('class'=>'form-control','rows'=>'4'))}}
</div>
Expand All @@ -84,14 +84,14 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Are you sure?</h4>
<h4 class="modal-title">{{ trans('admin.are_you_sure') }}</h4>
</div>
<div class="modal-body">
<p class="lead text-center">This Category will be deleted!</p>
<p class="lead text-center">{{ trans('admin.category_will_be_deleted') }}</p>
</div>
<div class="modal-footer">
<a data-dismiss="modal" href="#delete_category" class="btn btn-default">Keep</a>
<a href="" id="delete_link" class="btn btn-danger">Delete</a>
<a data-dismiss="modal" href="#delete_category" class="btn btn-default">{{ trans('admin.keep') }}</a>
<a href="" id="delete_link" class="btn btn-danger">{{ trans('admin.delete') }}</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
Expand Down
10 changes: 5 additions & 5 deletions app/views/admin/tags/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
@section('title','Editing tag')
@section('title', trans('admin.editing_tag'))

@section('content')
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="page-header">
<h1>Editing a tag <a href="{{ url('admin/tags')}}" class="btn btn-lg btn-default pull-right">Cancel</a></h1>
<h1>{{ trans('admin.editing_a_tag') }} <a href="{{ url('admin/tags')}}" class="btn btn-lg btn-default pull-right">{{ trans('admin.cancel') }}</a></h1>
</div>
@if($errors->all())
<div class="bs-callout bs-callout-danger">
<h4>Please fix the errors below:</h4>
<h4>{{ trans('admin.please_fix_errors') }}</h4>
{{ HTML::ul($errors->all())}}
</div>
@endif

{{ Form::model($tag,array('class'=>'form-horizontal'))}}
<div class="form-group">
<label for="name" class="col-lg-2 control-label">Name</label>
<label for="name" class="col-lg-2 control-label">{{ trans('admin.name') }}</label>
<div class="col-lg-10">
{{ Form::text('name',$tag->name,array('class'=>'form-control'))}}
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
{{ Form::submit('Save tag',array('class'=>'btn btn-primary btn-block')); }}
{{ Form::submit(trans('admin.save_tag'), array('class'=>'btn btn-primary btn-block')); }}
</div>
</div>
{{ Form::close()}}
Expand Down
Loading

0 comments on commit d54fec7

Please sign in to comment.