PHPackages                             krisboblea/laravel-translation-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. krisboblea/laravel-translation-manager

ActiveLibrary[Localization &amp; i18n](/categories/localization)

krisboblea/laravel-translation-manager
======================================

Manage Laravel Translations

1.0.1(6y ago)03MITPHPPHP &gt;=5.4.0

Since Jun 1Pushed 5y agoCompare

[ Source](https://github.com/KrisBobLea/laravel-translation-manager)[ Packagist](https://packagist.org/packages/krisboblea/laravel-translation-manager)[ RSS](/packages/krisboblea-laravel-translation-manager/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (37)Used By (0)

Laravel Translation Manager
===========================

[](#laravel-translation-manager)

Easy management of translations in Laravel.

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

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

[](#installation)

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

```
    "require": {
        "highsolutions/laravel-translation-manager": "^1.0"
    }
```

Run `composer update` to install the package.

Then, update `config/app.php` by adding an entry for the service provider:

```
'providers' => [
    // ...
    HighSolutions\TranslationManager\ManagerServiceProvider::class,
];
```

Next, publish all package resources:

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

This will add to your project:

```
- migration - database table for storing translations
- configuration - package configurations
- views - configurable views for translation management
- translations - translations for webinterface

```

Remember to launch migration:

```
    php artisan migrate
```

Workflow
--------

[](#workflow)

This package doesn't replace the Translation system, only import/export PHP files to a database and make them editable in browser. Package contains helper for live editing content on website.

The workflow would be:

```
- Import translations: Read all translation files and save them in the database
- Find all translations in php/twig sources
- Optionally: Listen to missing translation with the custom Translator
- Optionally: Mark not-translated records as not-translated (suffix command)
- Translate all keys through the webinterface
- Export: Write all translations back to the translation files.

```

Usage
-----

[](#usage)

You can access package in `http://yourdomain.com/translations` in default configuration. You can change as you pleased.

Configuration
-------------

[](#configuration)

Setting nameDescriptionDefault valuerouteRoute declaration (prefix, namespace, middlewares etc.)\[,'prefix' =&gt; 'translations', 'namespace' =&gt; 'HighSolutions\\TranslationManager', 'middleware' =&gt; \[,'web', 'auth',\],\]delete\_enabledEnable deletion of translationstrueexclude\_groupsExclude specific file groups (like validation, pagination, routes etc.)\[\]exclude\_langsExclude specific langs and directories (like vendor and en, etc.)\[\]basic\_langBasic language used by translator.'en'sort\_keysExport translations with keys output alphabetically.falsehighlight\_locale\_markedHighlight lines with locale marked as not translated.falselive\_translation\_enabledEnable live translation of content.falsepopup\_placementPosition of live translation popup.toppermissionsDefine whow and when can edit translations.env('APP\_ENV') == 'local'Commands
--------

[](#commands)

### Import command

[](#import-command)

The import command will search through app/lang and load all strings in the database, so you can easily manage them.

```
    php artisan translations:import
```

Note: By default, only new strings are added. Translations already in the DB are kept the same. If you want to replace all values with the ones from the files, add the `--replace` (or `-R`) option: `php artisan translations:import --replace`

### Find translations in source

[](#find-translations-in-source)

The Find command/button will look search for all php/twig files in the app directory, to see if they contain translation functions, and will try to extract the group/item names. The found keys will be added to the database, so they can be easily translated. This can be done through the webinterface, or via an Artisan command.

```
    php artisan translations:find
```

### Export command

[](#export-command)

The export command will write the contents of the database back to resources/lang php files. This will overwrite existing translations and remove all comments, so make sure to backup your data before using. Supply the group name to define which groups you want to publish. If you want to export all groups, provide `*` as name of group.

```
    php artisan translations:export
```

For example, `php artisan translations:export reminders` when you have 2 locales (en/pl), will write to `resources/lang/en/reminders.php` and `resources/lang/pl/reminders.php`

### Clean command

[](#clean-command)

The clean command will search for all translation that are NULL and delete them, so your interface is a bit cleaner. Note: empty translations are never exported.

```
    php artisan translations:clean
```

### Reset command

[](#reset-command)

The reset command simply clears all translation in the database, so you can start fresh (by a new import). Make sure to export your work if needed before doing this.

```
    php artisan translations:reset
```

### Clone command

[](#clone-command)

The clone command copy directory of basic language (langFrom parameter) and saves as new language (langTo parameter). After this operation you will need to launch import command.

```
    php artisan translations:clone langFrom langTo
```

### Suffix command

[](#suffix-command)

The suffix command analyzes all translations from new locale (langNew parameter) and if the value is the same as in original language (langOriginal parameter) then adds suffix to the end of value of new locale translations to mark that this translation needs to be translated. The suffix is locale code (e.g. EN) upper-cased.

```
    php artisan translations:sufix langOriginal langNew
```

### Detect missing translations

[](#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. 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',
    'HighSolutions\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. This way it shows up in the webinterface and can be edited and later exported. You shouldn't use this in production, just in production to translate your views, then just switch back.

Live editing
------------

[](#live-editing)

When you have translations in database, you can use `transEditable` method instead of `trans` whenever it's suitable. To do this, you have to make few steps:

Update `config/app.php` by adding an entry for the service provider (another one):

```
'providers' => [
    // ...
    HighSolutions\TranslationManager\TranslationServiceProvider::class,
];
```

Add these two methods to `app\helpers.php` file.

```
if (!function_exists('transEditable')) {
    /**
     * Translate the given message and wraps it in .editable container to allow editing
     *
     * @param  string  $id
     * @param  array   $parameters
     * @param  string  $domain
     * @param  string  $locale
     * @return \Symfony\Component\Translation\TranslatorInterface|string
     */
    function transEditable($id = null, $parameters = [], $domain = 'messages', $locale = null) {
        return app('translator')->transEditable($id, $parameters, $locale);
    }
}

if (!function_exists('isLiveTranslationEnabled')) {
    /**
     * Return true if live translation enabled
     *
     * @return bool
     */
    function isLiveTranslationEnabled() {
        return Request::cookie('live-translation-enabled') || config('translation-manager.live_translation_enabled');
    }
}
```

In your layout view add this scripts and style (see Layout customization section):

```

        .editable-click {
            border-bottom-color: red;
            cursor: pointer;
        }

        .editableform .control-group {
            display: block;
        }

        .editable-input {
            display: block;
        }

        .editable-input > textarea {
            width: 100% !important;
        }

        .editable-buttons {
            margin: 10px 0 0;
            text-align: right;
            width: 100%;
        }

        .editable-buttons .editable-submit {
            float: right;
            margin-left: 10px;
        }

    // ...

```

If you want to change all links into non-links, add this little script:

```

    $('.editable').parent('a').replaceWith(function () {
            return $('', {
                html: this.innerHTML
            });
        }
    );

```

Last step is to add this JS file:

```
jQuery(document).ready(function($){

    $.ajaxSetup({
        beforeSend: function(xhr, settings) {
            settings.data += "&_token=" + $(':hidden[name="_token"]').val();
        }
    });

    $('.editable').editable().on('hidden', function(e, reason){
        var locale = $(this).data('locale');
        if(reason === 'save'){
            $(this).removeClass('status-0').addClass('status-1');
        }
        if(reason === 'save' || reason === 'nochange') {
            var $next = $(this).closest('tr').next().find('.editable.locale-'+locale);
            setTimeout(function() {
                $next.editable('show');
            }, 300);
        }
    });

    $(document).on('click', 'a', function(event) {
        if (event.target.localName !== 'a' && event.target.className.indexOf('editable-submit') !== -1) {
            event.preventDefault();
            return false;
        }
    });
});

```

And now you are able to use `transEditable` helper and when live editing is active (checked through `isLiveTranslationEnabled`), user is able to click on text, popup will show and text can be changed. Saving changes will cause saving to the database and exporting this text to translation file. If live editing is not active, user will see standard text.

You can use this helper like this:

```
	{!! transEditable('auth.failed') !!}
```

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
---------

[](#changelog)

1.0.0

- Support Laravel 6.0

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
-------

[](#roadmap)

- Duplicate translations of one locale to another with locale suffix.
- Detection of incorrect files.
- Support vendor translations files.
- Unit tests!

Credits
-------

[](#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).

Currently is developed by [HighSolutions](http://highsolutions.pl), software house from Poland in love in Laravel.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 55.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Recently: every ~86 days

Total

35

Last Release

2442d ago

Major Versions

0.6.1 → 1.0.02019-09-04

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.0

v0.1.3PHP &gt;=5.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24961323?v=4)[Krisbo](/maintainers/krisboblea)[@krisboblea](https://github.com/krisboblea)

---

Top Contributors

[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (88 commits)")[![adammatysiak](https://avatars.githubusercontent.com/u/25105267?v=4)](https://github.com/adammatysiak "adammatysiak (30 commits)")[![cossou](https://avatars.githubusercontent.com/u/1337112?v=4)](https://github.com/cossou "cossou (7 commits)")[![sangnguyenplus](https://avatars.githubusercontent.com/u/6972407?v=4)](https://github.com/sangnguyenplus "sangnguyenplus (3 commits)")[![uusa35](https://avatars.githubusercontent.com/u/3815504?v=4)](https://github.com/uusa35 "uusa35 (2 commits)")[![al0mie](https://avatars.githubusercontent.com/u/5223895?v=4)](https://github.com/al0mie "al0mie (2 commits)")[![anorgan](https://avatars.githubusercontent.com/u/1270389?v=4)](https://github.com/anorgan "anorgan (2 commits)")[![honjoya](https://avatars.githubusercontent.com/u/688954?v=4)](https://github.com/honjoya "honjoya (2 commits)")[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (2 commits)")[![UnrulyNatives](https://avatars.githubusercontent.com/u/6769986?v=4)](https://github.com/UnrulyNatives "UnrulyNatives (1 commits)")[![immeyti](https://avatars.githubusercontent.com/u/24190257?v=4)](https://github.com/immeyti "immeyti (1 commits)")[![imTigger](https://avatars.githubusercontent.com/u/4729517?v=4)](https://github.com/imTigger "imTigger (1 commits)")[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (1 commits)")[![jpmurray](https://avatars.githubusercontent.com/u/1550428?v=4)](https://github.com/jpmurray "jpmurray (1 commits)")[![laszlokis-lynx](https://avatars.githubusercontent.com/u/258006090?v=4)](https://github.com/laszlokis-lynx "laszlokis-lynx (1 commits)")[![laurentvd](https://avatars.githubusercontent.com/u/408083?v=4)](https://github.com/laurentvd "laurentvd (1 commits)")[![markwalet](https://avatars.githubusercontent.com/u/11446771?v=4)](https://github.com/markwalet "markwalet (1 commits)")[![nickjedwards](https://avatars.githubusercontent.com/u/46484451?v=4)](https://github.com/nickjedwards "nickjedwards (1 commits)")[![ALTELMA](https://avatars.githubusercontent.com/u/4938568?v=4)](https://github.com/ALTELMA "ALTELMA (1 commits)")[![RogueSheep-nl](https://avatars.githubusercontent.com/u/429560?v=4)](https://github.com/RogueSheep-nl "RogueSheep-nl (1 commits)")

---

Tags

laraveltranslationslanguagetranslator

### Embed Badge

![Health badge](/badges/krisboblea-laravel-translation-manager/health.svg)

```
[![Health](https://phpackages.com/badges/krisboblea-laravel-translation-manager/health.svg)](https://phpackages.com/packages/krisboblea-laravel-translation-manager)
```

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)[kkomelin/laravel-translatable-string-exporter

Translatable String Exporter for Laravel

3291.4M10](/packages/kkomelin-laravel-translatable-string-exporter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
