Skip to content

Commit

Permalink
add handling of nested directories under lang and soft delete/undelet…
Browse files Browse the repository at this point in the history
…e of translations
  • Loading branch information
vsch committed Jul 18, 2015
1 parent 015dba1 commit 7a4bd49
Show file tree
Hide file tree
Showing 22 changed files with 915 additions and 186 deletions.
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "barryvdh/laravel-translation-manager",
"name": "vsch/laravel-translation-manager",
"description": "Manage Laravel Translations",
"keywords": ["laravel", "translations", "translator"],
"license": "MIT",
"authors": [
{
"name": "Vladimir Schneider",
"email": "vladimir.schneider@gmail.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
Expand All @@ -16,12 +20,13 @@
"symfony/finder": "~2.3"
},
"autoload": {
"psr-0": {
"Vsch\\TranslationManager\\": "gorhill/p-hp-fine-diff/src",
"Vsch\\TranslationManager\\": "src/"
},
"classmap": [
"src/migrations"
],
"psr-0": {
"Barryvdh\\TranslationManager\\": "src/"
}
]
},
"minimum-stability": "stable"
}
191 changes: 191 additions & 0 deletions public/css/translations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
.editable-click,
a.editable-click,
a.editable-click:hover {
text-decoration: none;
border-bottom: dashed 1px #0088cc;
}

.translation-manager .editable-click,
.translation-manager a.editable-click,
.translation-manager a.editable-click:hover {
text-decoration: none;
border-bottom: none;
}

h1 .editable-click, h1 a.editable-click, h1 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #0088cc;
}

h2 .editable-click, h2 a.editable-click, h2 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #0088cc;
}

h3 .editable-click, h3 a.editable-click, h3 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #0088cc;
}

h4 .editable-click, h4 a.editable-click, h4 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #0088cc;
}

h5 .editable-click, h5 a.editable-click, h5 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #0088cc;
}

h6 .editable-click, h6 a.editable-click, h6 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #0088cc;
}

.translation-manager h1 .editable-click, h1 a.editable-click, h1 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #FF00cc !important;
}

.translation-manager h2 .editable-click, h2 a.editable-click, h2 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #FF00cc !important;
}

.translation-manager h3 .editable-click, h3 a.editable-click, h3 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #FF00cc !important;
}

.translation-manager h4 .editable-click, h4 a.editable-click, h4 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #FF00cc !important;
}

.translation-manager h5 .editable-click, h5 a.editable-click, h5 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #FF00cc !important;
}

.translation-manager h6 .editable-click, h6 a.editable-click, h6 a.editable-click:hover {
text-decoration: none;
border-bottom: none;
border-bottom: dashed 1px #FF00cc !important;
}

.table.translation-stats > thead > tr > th,
.table.translation-stats > tbody > tr > td {
margin: 0 0 0 !important;
padding: 2px 6px 2px 6px;
}

.table.translation-stats > thead > tr > th.missing
.table.translation-stats > tbody > tr > td.changed {
text-align: right;
padding-right: 8px;
}

.table.translation-stats > tbody > tr > td.group {
text-align: left;
font-weight: bold;
padding-left: 8px;
}

.table.translation-stats > thead > tr > th.deleted,
.table.translation-stats > tbody > tr > td.group.deleted > a
{
color: #3399f3;
}

.table.translation-stats > thead > tr > th.missing,
.table.translation-stats > tbody > tr > td.group.missing > a {
color: #d00030;
}

.table.translation-stats > thead > tr > th.changed,
.table.translation-stats > tbody > tr > td.group.changed > a {
color: #00A030;
}

textarea.editable-input {
width: 600px !important;
display: block !important;
}

.editable-container.editable-inline {
display: block !important;
width: 400px !important;
}

.editable-container .editable-error-block {
display: block !important;
max-width: 600px !important;
}

.editable-buttons .editable-translate {
margin-left: 1px;
}

.table-translations tr.editing {
backround-color: rgba(255, 255, 100, .3);
}

.table-striped > tbody > tr.editing:nth-of-type(odd) {
background-color: #f7f9da;
}

.table-striped > tbody > tr.editing:nth-of-type(even) {
background-color: #fffdd9;
}

/*.table-translations tr.deleted-translation {*/
/*text-decoration: line-through;*/
/*}*/

.table-translations tr.deleted-translation {
backround-color: rgba(255, 130, 147, 0.31);
}

.table-striped > tbody > tr.deleted-translation:nth-of-type(odd) {
background-color: #f5e1e3;
}

.table-striped > tbody > tr.deleted-translation:nth-of-type(even) {
background-color: #ffebec;
}

.table-translations tr.editing.deleted-translation {
backround-color: rgba(255, 136, 77, 0.41);
}

.table-striped > tbody > tr.editing.deleted-translation:nth-of-type(odd) {
background-color: #f5d3c4;
}

.table-striped > tbody > tr.editing.deleted-translation:nth-of-type(even) {
background-color: #ffdccc;
}

a.status-1 {
font-weight: bold;
}

del {
color: #C80010;
}

ins {
color: #108030;
}

21 changes: 10 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ This way, translations can be saved in git history and no overhead is introduced

## Installation

Require this package in your composer.json and run composer update (or run `composer require barryvdh/laravel-translation-manager:*` directly):
Require this package in your composer.json and run composer update (or run `composer require vsch/laravel-translation-manager:*` directly):

"barryvdh/laravel-translation-manager": "0.1.x"
"vsch/laravel-translation-manager": "0.1.x"

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

'Barryvdh\TranslationManager\ManagerServiceProvider',
'Vsch\TranslationManager\ManagerServiceProvider',

You need to run the migrations for this package

$ php artisan migrate --package="barryvdh/laravel-translation-manager"
$ php artisan migrate --package="vsch/laravel-translation-manager"

You need to publish the config file for this package. This will add the file `app/config/packages/barryvdh/laravel-translation-manager/config.php`, where you can configure this package.
You need to publish the config file for this package. This will add the file `app/config/packages/vsch/laravel-translation-manager/config.php`, where you can configure this package.

$ php artisan config:publish barryvdh/laravel-translation-manager
$ php artisan config:publish vsch/laravel-translation-manager

You have to add the Controller to your routes.php, so you can set your own url/filters.

Route::group(array('before' => 'auth_admin'), function() {
Route::controller('translations', 'Barryvdh\TranslationManager\Controller');
Route::controller('translations', 'vsch\TranslationManager\Controller');
});

This example will make the translation manager available at `http://yourdomain.com/translations`
Expand Down Expand Up @@ -91,16 +91,15 @@ The reset command simply clears all translation in the database, so you can star

$ php artisan translations:reset



### Detect missing translations
### Detect missing translations and enable in-place translation editing

Most translations can be found by using the Find command (see above), but in case you have dynamic keys (variables/automatic forms etc), it can be helpful to 'listen' to the missing translations.
To detect missing translations, we can swap the Laravel TranslationServicepProvider with a custom provider.
In your config/app.php, comment out the original TranslationServiceProvider and add the one from this package:

//'Illuminate\Translation\TranslationServiceProvider',
'Barryvdh\TranslationManager\TranslationServiceProvider',
'Vsch\TranslationManager\TranslationServiceProvider',
'Vsch\TranslationManager\ManagerServiceProvider',

This will extend the Translator and will create a new database entry, whenever a key is not found, so you have to visit the pages that use them.
This way it shows up in the webinterface and can be edited and later exported.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Barryvdh\TranslationManager\Console;
<?php namespace Vsch\TranslationManager\Console;

use Barryvdh\TranslationManager\Manager;
use Vsch\TranslationManager\Manager;
use Illuminate\Console\Command;

class CleanCommand extends Command {
Expand All @@ -19,7 +19,7 @@ class CleanCommand extends Command {
*/
protected $description = 'Clean empty translations';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var \Vsch\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Barryvdh\TranslationManager\Console;
<?php namespace Vsch\TranslationManager\Console;

use Barryvdh\TranslationManager\Manager;
use Vsch\TranslationManager\Manager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;

Expand All @@ -20,7 +20,7 @@ class ExportCommand extends Command {
*/
protected $description = 'Export translations to PHP files';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var \Vsch\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Barryvdh\TranslationManager\Console;
<?php namespace Vsch\TranslationManager\Console;

use Barryvdh\TranslationManager\Manager;
use Vsch\TranslationManager\Manager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;

Expand All @@ -20,7 +20,7 @@ class FindCommand extends Command {
*/
protected $description = 'Find translations in php/twig files';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var \Vsch\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Barryvdh\TranslationManager\Console;
<?php namespace Vsch\TranslationManager\Console;

use Barryvdh\TranslationManager\Manager;
use Vsch\TranslationManager\Manager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;

Expand All @@ -20,7 +20,7 @@ class ImportCommand extends Command {
*/
protected $description = 'Import translations from the PHP sources';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var \Vsch\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Barryvdh\TranslationManager\Console;
<?php namespace Vsch\TranslationManager\Console;

use Illuminate\Console\Command;
use Barryvdh\TranslationManager\Manager;
use Vsch\TranslationManager\Manager;

class ResetCommand extends Command {

Expand All @@ -19,7 +19,7 @@ class ResetCommand extends Command {
*/
protected $description = 'Delete all translations from the database';

/** @var \Barryvdh\TranslationManager\Manager */
/** @var \Vsch\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
Loading

0 comments on commit 7a4bd49

Please sign in to comment.