Adding translation of product page

The news/product/*.blade.php files are translated into PTB.
This commit is contained in:
Bruno F. Fontes 2018-09-28 01:54:51 -03:00
parent 63ef369e16
commit c9c92f7e07
8 changed files with 152 additions and 28 deletions

View File

@ -0,0 +1,63 @@
<?php
/**
* Strings from the product pages
* They are separeted by the file that calls them.
* Sometimes, a string is used on another file,
* so it will stay at the common segment.
*/
return [
/**
* COMMON
*/
'insert' => 'Insert',
'close' => 'Close',
'' => '',
'' => '',
/**
* addItemForm.blade.php
*/
'item' => 'Item:',
'100yearsSolitude' => 'One Hundred Years of Solitude',
/**
* addProductForm.blade.php
*/
'name' => 'Name:',
'book' => 'Book',
'url' => 'URL:',
'optionalUrlExample' => '(Optional) http://bookwebsite.com',
/**
* deleteButton.blade.php
*/
'delete' => 'Delete',
'confirmation' => 'Confirmation...',
'wannaDelete' => "Would you like to delete the product <strong>:productname</strong> and it's items?",
'notAbleRestore' => 'You will not be able to restore it after deletion.',
/**
* editButton.blade.php
*/
'edit' => 'Edit',
'editProduct' => 'Edit product',
'newName' => 'New name:',
'newUrl' => 'New url:',
/**
* index.blade.php
*/
'products' => 'Products',
'noProductsYet' => 'There are no products yet. Include one with the form above.',
'addProduct' => 'Add product',
'yourItems' => 'Your items',
/**
* show.blade.php
*/
'items' => 'Items:',
'noItemsYet' => 'There are no items yet. Include one with the form above.',
'addItem' => 'Add item',
'back' => 'BACK',
];

View File

@ -0,0 +1,61 @@
<?php
/**
* Strings from the product pages
* They are separeted by the file that calls them.
* Sometimes, a string is used on another file,
* so it will stay at the common segment.
*/
return [
/**
* COMMON
*/
'insert' => 'Inserir',
'close' => 'Fechar',
/**
* addItemForm.blade.php
*/
'item' => 'Item:',
'100yearsSolitude' => 'Cem anos de solidão',
/**
* addProductForm.blade.php
*/
'name' => 'Nome:',
'book' => 'Livro',
'url' => 'URL:',
'optionalUrlExample' => '(Opcional) http://sitedolivro.com.br',
/**
* deleteButton.blade.php
*/
'delete' => 'Apagar',
'confirmation' => 'Confirmação...',
'wannaDelete' => "Você gostaria de apagar o produto <strong>:productname</strong> e seus items?",
'notAbleRestore' => 'Não será possível recuperá-los depois.',
/**
* editButton.blade.php
*/
'edit' => 'Editar',
'editProduct' => 'Editar produto',
'newName' => 'Novo nome:',
'newUrl' => 'Nova url:',
/**
* index.blade.php
*/
'products' => 'Produtos',
'noProductsYet' => 'Ainda não há produtos cadastrados. Inclua um no formulário acima.',
'addProduct' => 'Incluir produto',
'yourItems' => 'Seus items',
/**
* show.blade.php
*/
'items' => 'Items:',
'noItemsYet' => 'Ainda não há itens cadastrados. Inclua um no formulário acima.',
'addItem' => 'Incluir item',
'back' => 'VOLTAR',
];

View File

@ -3,10 +3,10 @@
<div class="container-fluid">
<div class="form-group row mt-2">
<div class="col-sm-2 col-lg-1"><label for="product">Item:</label></div>
<div class="col-xs-12 col-sm mb-3"><input type="text" class="form-control" name="item" id="item" placeholder="One Hundred Years of Solitude" required></div>
<div class="col-sm-2 col-lg-1"><label for="product">{{ __('product.item') }}</label></div>
<div class="col-xs-12 col-sm mb-3"><input type="text" class="form-control" name="item" id="item" placeholder="{{ __('product.100yearsSolitude') }}" required></div>
<input type="hidden" name="product_id" id="product_id" value="{{ $product['id'] }}" required>
<div class="col-sm-2 col-lg-1 mr-4"><button type="submit" class="btn btn-primary">Insert</button></div>
<div class="col-sm-2 col-lg-1 mr-4"><button type="submit" class="btn btn-primary">{{ __('product.insert') }}</button></div>
</div>
</div>

View File

@ -2,16 +2,16 @@
{{ csrf_field() }}
<div class="container-fluid">
<div class="form-group row mt-2">
<div class="col-sm-2 col-lg-1"><label for="product">Name:</label></div>
<div class="col-xs-12 col-sm"><input type="text" class="form-control" name="product" id="product" placeholder="Book" required></div>
<div class="col-sm-2 col-lg-1"><label for="product">{{ __('product.name') }}</label></div>
<div class="col-xs-12 col-sm"><input type="text" class="form-control" name="product" id="product" placeholder="{{ __('product.book') }}" required></div>
</div>
<div class="form-group row mt-2">
<div class="col-sm-2 col-lg-1"><label for="product">URL:</label></div>
<div class="col-xs-12 col-sm"><input type="text" class="form-control" name="url" id="url" placeholder="(Optional) http://bookwebsite.com"></div>
<div class="col-sm-2 col-lg-1"><label for="product">{{ __('product.url') }}</label></div>
<div class="col-xs-12 col-sm"><input type="text" class="form-control" name="url" id="url" placeholder="{{ __('product.optionalUrlExample') }}"></div>
</div>
<div class="form-group row mt-2">
<div class="col-xs-0 col-sm-1 col-md-1 col-lg-1 col-xg-1"></div>
<div class="col col-xs-12"><button type="submit" class="btn btn-primary">Insert</button></div>
<div class="col col-xs-12"><button type="submit" class="btn btn-primary">{{ __('product.insert') }}</button></div>
</div>
</div>
@include ('layouts.errors')

View File

@ -1,26 +1,26 @@
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal">Delete</button>
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#deleteModal">{{ __('product.delete') }}</button>
<!-- MODAL - DELETE CONFIRMATION -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">Confirmation...</h5>
<h5 class="modal-title" id="deleteModalLabel">{{ __('product.confirmation') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Would you like to delete the product <strong>{{$product->name}}</strong> and it's items?
<p>You will not be able to restore it after deletion.</p>
{!! __('product.wannaDelete', ['productname' => $product->name]) !!}
<p>{{ __('product.notAbleRestore') }}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ __('product.close') }}</button>
<form action="/product" method="POST">
@method('DELETE')
{{ csrf_field() }}
<input type="hidden" name="product" value="{{$product->id}}">
<button type="submit" class="btn btn-danger">Delete</button>
<button type="submit" class="btn btn-danger">{{ __('product.delete') }}</button>
</form>
</div>
</div>

View File

@ -1,11 +1,11 @@
<button type="button" class="btn btn-sm btn-secondary mr-1" data-toggle="modal" data-target="#editModal">Edit</button>
<button type="button" class="btn btn-sm btn-secondary mr-1" data-toggle="modal" data-target="#editModal">{{ __('product.edit') }}</button>
<!-- MODAL - CHANGE WINDOW -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editModalLabel">Edit product</h5>
<h5 class="modal-title" id="editModalLabel">{{ __('product.editProduct') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
@ -14,11 +14,11 @@
<form action="/product" method="POST">
<div class="modal-body">
<div class="form-group">
<label for="name" class="col-form-label">New name: </label>
<label for="name" class="col-form-label">{{ __('product.newName') }} </label>
<input type="text" name="name" id="name" class="form-control" value="{{$product->name}}">
</div>
<div class="form-group">
<label for="url" class="col-form-label">New url: </label>
<label for="url" class="col-form-label">{{ __('product.newUrl') }} </label>
<input type="text" name="url" id="url" class="form-control" value="{{$product->url}}">
</div>
</div>
@ -26,8 +26,8 @@
@method('PATCH')
{{ csrf_field() }}
<input type="hidden" name="product" value="{{$product->id}}">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Edit</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ __('product.close') }}</button>
<button type="submit" class="btn btn-danger">{{ __('product.edit') }}</button>
</div>
</form>

View File

@ -5,7 +5,7 @@
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card mt-4">
<div class="card-header"><strong>Products</strong></div>
<div class="card-header"><strong>{{ __('product.products') }}</strong></div>
<div class="card-body">
@if (session('status'))
@ -18,17 +18,17 @@
@forelse ($products as $product)
<li><a href="/product/{{$product['id']}}">{{$product['name']}}</a></li>
@empty
<p>There are no products yet. Include one with the form above.</p>
<p>{{ __('product.noProductsYet') }}</p>
@endforelse
</ul>
</div>
</div>
<div class="card mt-4">
<div class="card-header">Add product</div>
<div class="card-header">{{ __('product.addProduct') }}</div>
<div class="card-body">@include('product.addProductForm')</div>
</div>
<div class="float-right mt-2"><a class="btn btn-secondary" href="/home">Your items</a></div>
<div class="float-right mt-2"><a class="btn btn-secondary" href="/home">{{ __('product.yourItems') }}</a></div>
</div>
</div>
</div>

View File

@ -25,23 +25,23 @@
</div>
@endif
<strong>Items:</strong>
<strong>{{ __('product.items') }}</strong>
<ul>
@forelse ($product->items as $item)
<li><a href="/item/{{ $item->id }}">{{ $item->name }}</a></li>
@empty
<p>There are no items yet. Include one with the form above.</p>
<p>{{ __('product.noItemsYet') }}</p>
@endforelse
</ul>
</div>
</div>
<div class="card mt-4">
<div class="card-header">Add item</div>
<div class="card-header">{{ __('product.addItem') }}</div>
<div class="card-body">@include('product.addItemForm')</div>
</div>
<div class="float-right mt-2"><a class="btn btn-secondary" href="/product">BACK</a></div>
<div class="float-right mt-2"><a class="btn btn-secondary" href="/product">{{ __('product.back') }}</a></div>
</div>
</div>
</div>