Skip to content

Fixed HTML escaping >= Laravel 5.6 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.phar
composer.lock
.DS_Store
.idea
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Copyright (C) 2014 Barry vd. Heuvel
Copyright (C) 2017 HighSolutions
Copyright (C) 2019 Tiger Fok

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
21 changes: 13 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
{
"name": "highsolutions/laravel-translation-manager",
"name": "imtigger/laravel-translation-manager",
"description": "Manage Laravel Translations",
"keywords": ["laravel", "translations", "translator", "language"],
"license": "MIT",
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
},
},
{
"name": "HighSolutions",
"email": "adam@highsolutions.pl"
},
{
"name": "Tiger Fok",
"email": "tiger@tiger-workshop.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/console": "5.*",
"illuminate/support": "5.*",
"symfony/finder": "*"
"illuminate/console": "5.*|6.*",
"illuminate/support": "5.*|6.*",
"symfony/finder": "*",
"google/cloud-translate": "^1.7"
},
"autoload": {
"psr-4": {
"HighSolutions\\TranslationManager\\": "src/"
"Imtigger\\TranslationManager\\": "src/"
}
},
"extra": {
"component": "package",
"frameworks": ["Laravel 5.7"],
"laravel": {
"providers": [
"HighSolutions\\TranslationManager\\ManagerServiceProvider",
"HighSolutions\\TranslationManager\\TranslationServiceProvider"
"Imtigger\\TranslationManager\\ManagerServiceProvider",
"Imtigger\\TranslationManager\\TranslationServiceProvider"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion config/translation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
'route' => [
'prefix' => 'translations',
'namespace' => 'HighSolutions\TranslationManager',
'namespace' => 'Imtigger\TranslationManager',
'middleware' => [
'web',
'auth',
Expand Down
Binary file removed intro.jpg
Binary file not shown.
94 changes: 31 additions & 63 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ Laravel Translation Manager

Easy management of translations in Laravel.

![Laravel-Translation-Manager by HighSolutions](https://github.com/highsolutions/laravel-translation-manager/master/intro.jpg)

Installation
------------

Add the following line to the `require` section of your Laravel webapp's `composer.json` file:

```javascript
"require": {
"highsolutions/laravel-translation-manager": "0.4.x"
"Imtigger/laravel-translation-manager": "^0.7"
}
```

Expand All @@ -23,14 +21,14 @@ Then, update `config/app.php` by adding an entry for the service provider:
```php
'providers' => [
// ...
HighSolutions\TranslationManager\ManagerServiceProvider::class,
Imtigger\TranslationManager\ManagerServiceProvider::class,
];
```

Next, publish all package resources:

```bash
php artisan vendor:publish --provider="HighSolutions\TranslationManager\ManagerServiceProvider"
php artisan vendor:publish --provider="Imtigger\TranslationManager\ManagerServiceProvider"
```

This will add to your project:
Expand Down Expand Up @@ -71,7 +69,7 @@ Configuration

| Setting name | Description | Default value |
|--------------------------|-------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| route | Route declaration (prefix, namespace, middlewares etc.) | [,'prefix' => 'translations', 'namespace' => 'HighSolutions\TranslationManager', 'middleware' => [,'web', 'auth',],] |
| route | Route declaration (prefix, namespace, middlewares etc.) | [,'prefix' => 'translations', 'namespace' => 'Imtigger\TranslationManager', 'middleware' => [,'web', 'auth',],] |
| delete_enabled | Enable deletion of translations | true |
| exclude_groups | Exclude specific file groups (like validation, pagination, routes etc.) | [] |
| exclude_langs | Exclude specific langs and directories (like vendor and en, etc.) | [] |
Expand Down Expand Up @@ -152,6 +150,25 @@ The suffix command analyzes all translations from new locale (langNew parameter)
php artisan translations:sufix langOriginal langNew
```

### Generate command

The generate command find empty value in the database with specified locale (default en), and generate value using last part of the translation key. Best used with "Detect missing translations".

Example:
- "backend.label.order_number" becomes "Order Number"
- "backend.action-button.submit-form" becomes "Submit Form"

```bash
php artisan translations:generate [--import] [--export] [--group=backend] [--locale=en]
```

Options:
- --import Import translation before generating
- --export Export translation immediately
- --locale[=LOCALE] Translation locale [default: "en"]
- --group[=GROUP] Translation group [default: "backend"]


### Detect missing translations

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.
Expand All @@ -160,7 +177,7 @@ In your config/app.php, comment out the original TranslationServiceProvider and

```php
//'Illuminate\Translation\TranslationServiceProvider',
'HighSolutions\TranslationManager\TranslationServiceProvider',
'Imtigger\TranslationManager\TranslationServiceProvider',
```

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.
Expand All @@ -177,7 +194,7 @@ Update `config/app.php` by adding an entry for the service provider (another one
```php
'providers' => [
// ...
HighSolutions\TranslationManager\TranslationServiceProvider::class,
Imtigger\TranslationManager\TranslationServiceProvider::class,
];
```

Expand Down Expand Up @@ -305,68 +322,19 @@ You can use this helper like this:

Do not use this inside of non-clickable elements (title attribute, alt attributes etc.). To launch popup inside link, click on border, not text.

Changelog
---------

0.6.0
* No STRICT_MODE needed anymore

0.5.1
* Fix searching translations

0.5.0
* Change the views path

0.4.7
* remove closures in config file

0.4.5
* Laravel 5.6 support

0.4.4
* Fix translation title popup

0.4.3
* New configurations (popup placement and basic language)
* Update documentation about necessary JS scripts

0.4.0

* New commands: clone and suffix
* Improve export command

0.3.7

* New configuration option to exclude langs

0.3.6

* Support auto-discovery and Laravel 5.5

0.3.0

* Support for subdirectories
* Support for array translations
* New design
* Permission management
* Translations for view
* Live editing

0.2.0

* Barryvdh version of package

Roadmap
-------

* Duplicate translations of one locale to another with locale suffix.
* Detection of incorrect files.
* Support vendor translations files.
* Auto generate placeholder from key
* Auto Tradition Simplifed <=> Simplifed Chinese convertion
* Unit tests!

Credits
-------

This package was originally created by [Barry vd. Heuvel](https://github.com/barryvdh) and is available here: [laravel-feed](https://github.com/barryvdh/laravel-translation-manager).
This package was originally created by [Barry vd. Heuvel](https://github.com/barryvdh) and is available here: [laravel-translation-manager](https://github.com/barryvdh/laravel-translation-manager)

And then developed by [HighSolutions](https://github.com/highsolutions) and is available here: [laravel-translation-manager](https://github.com/highsolutions/laravel-translation-manager)

Currently is developed by [HighSolutions](http://highsolutions.pl), software house from Poland in love in Laravel.
Currently is developed by [Imtigger](http://tiger-workshop.com)
7 changes: 4 additions & 3 deletions resources/views/key_row.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@endphp
@if(is_array($translation) && $isCatalog)
<tr class="empty" data-base="{{ $parent_key . $key }}">
<td colspan="{{ 1 + sizeof($locales) + $deleteEnabled }}">{{ str_repeat("&nbsp;", $indent * 4) . $key }}</td>
<td colspan="{{ 1 + sizeof($locales) + $deleteEnabled }}">{!! str_repeat("&nbsp;", $indent * 4) . $key !!}</td>
</tr>
@foreach($translation as $key2 => $value2)
@include('translation-manager::key_row', [
Expand All @@ -21,7 +21,7 @@
@endforeach
@else
<tr data-parent="{{ rtrim($parent_key, '.') }}" id="{{ $parent_key . $key }}">
<td>{{ str_repeat("&nbsp;", $indent * 4) . $key }}</td>
<td>{!! str_repeat("&nbsp;", $indent * 4) . $key !!}</td>
@foreach($locales as $locale)
@php $t = isset($translation[$locale]) ? $translation[$locale] : null; @endphp
<td>
Expand All @@ -48,4 +48,5 @@
</td>
@endif
</tr>
@endif
@endif

6 changes: 3 additions & 3 deletions src/Console/CleanCommand.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace HighSolutions\TranslationManager\Console;
namespace Imtigger\TranslationManager\Console;

use HighSolutions\TranslationManager\Manager;
use Imtigger\TranslationManager\Manager;
use Illuminate\Console\Command;

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

/** @var \HighSolutions\TranslationManager\Manager */
/** @var \Imtigger\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
6 changes: 3 additions & 3 deletions src/Console/CloneCommand.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace HighSolutions\TranslationManager\Console;
namespace Imtigger\TranslationManager\Console;

use HighSolutions\TranslationManager\Manager;
use Imtigger\TranslationManager\Manager;
use Illuminate\Console\Command;

class CloneCommand extends Command
Expand All @@ -22,7 +22,7 @@ class CloneCommand extends Command
*/
protected $description = 'Clone translations from one language to another';

/** @var \HighSolutions\TranslationManager\Manager */
/** @var \Imtigger\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
6 changes: 3 additions & 3 deletions src/Console/ExportCommand.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace HighSolutions\TranslationManager\Console;
namespace Imtigger\TranslationManager\Console;

use HighSolutions\TranslationManager\Manager;
use Imtigger\TranslationManager\Manager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;

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

/** @var \HighSolutions\TranslationManager\Manager */
/** @var \Imtigger\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
6 changes: 3 additions & 3 deletions src/Console/FindCommand.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace HighSolutions\TranslationManager\Console;
namespace Imtigger\TranslationManager\Console;

use HighSolutions\TranslationManager\Manager;
use Imtigger\TranslationManager\Manager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;

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

/** @var \HighSolutions\TranslationManager\Manager */
/** @var \Imtigger\TranslationManager\Manager */
protected $manager;

public function __construct(Manager $manager)
Expand Down
Loading