PHPackages                             philo/laravel-translate - 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. philo/laravel-translate

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

philo/laravel-translate
=======================

Translation manager for Laravel 5

v2.0.2(9y ago)8731.8k8[5 issues](https://github.com/PhiloNL/laravel-translate/issues)[2 PRs](https://github.com/PhiloNL/laravel-translate/pulls)1MITPHPPHP &gt;=5.3.0

Since Jan 5Pushed 9y ago8 watchersCompare

[ Source](https://github.com/PhiloNL/laravel-translate)[ Packagist](https://packagist.org/packages/philo/laravel-translate)[ RSS](/packages/philo-laravel-translate/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (1)Versions (13)Used By (1)

Translation manager for Laravel 5
=================================

[](#translation-manager-for-laravel-5)

[![](https://camo.githubusercontent.com/3c275cc7878eeea9fbc85733e13661b9a102b39c03363148268a637c9cebb81d/68747470733a2f2f706f7365722e707567782e6f72672f7068696c6f2f6c61726176656c2d7472616e736c6174652f76657273696f6e2e706e67)](https://camo.githubusercontent.com/3c275cc7878eeea9fbc85733e13661b9a102b39c03363148268a637c9cebb81d/68747470733a2f2f706f7365722e707567782e6f72672f7068696c6f2f6c61726176656c2d7472616e736c6174652f76657273696f6e2e706e67) [![](https://camo.githubusercontent.com/d474db28b493f1871ee699e1ab3c87cc645e1f3c31f3275716c3ec8b9cad7b4b/68747470733a2f2f706f7365722e707567782e6f72672f7068696c6f2f6c61726176656c2d7472616e736c6174652f646f776e6c6f6164732e706e67)](https://camo.githubusercontent.com/d474db28b493f1871ee699e1ab3c87cc645e1f3c31f3275716c3ec8b9cad7b4b/68747470733a2f2f706f7365722e707567782e6f72672f7068696c6f2f6c61726176656c2d7472616e736c6174652f646f776e6c6f6164732e706e67)

Managing translations can be a pain, switching between different language files, adding new strings, keeping everything in sync and removing translations which are no longer being used.

But that's in the past if you install this package!

Features
--------

[](#features)

Lets take a look at all the features included in this package.

### Adding new translations

[](#adding-new-translations)

To add a new translation you need to open your terminal, and run the following command:

`php artisan translate:add [--bench[="..."]] [--no-entities]  `

So for a example: `php artisan translate:add profile first_name`

[![1](https://camo.githubusercontent.com/7377451f091e5b391f8df4eb4cd33867d99f88fb31a01f1e361b8d3d79a21892/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343636382f66336331663831652d376166362d313165332d386665322d3635663831366234623966312e706e67)](https://camo.githubusercontent.com/7377451f091e5b391f8df4eb4cd33867d99f88fb31a01f1e361b8d3d79a21892/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343636382f66336331663831652d376166362d313165332d386665322d3635663831366234623966312e706e67)

As you can see, you will get the blade syntax returned so you can copy and paste it to your view. Adding variables to your string will result in a different syntax: `php artisan translate:add profile texts.introduction`

[![2](https://camo.githubusercontent.com/d14a509509f4c94214547dba8c034b79d621988d7079f5014420f07f82757cff/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732342f33626363306363342d376166392d313165332d396333312d3533333362633735643139652e706e67)](https://camo.githubusercontent.com/d14a509509f4c94214547dba8c034b79d621988d7079f5014420f07f82757cff/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732342f33626363306363342d376166392d313165332d396333312d3533333362633735643139652e706e67)

Translation files are dynamically generated in alphabetical order and equally spaced.

[![3](https://camo.githubusercontent.com/8db2920a29da874acce744cbdb713bc06226da50ede6ac967380ddd280f8fab9/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732362f34313663393838382d376166392d313165332d393266362d3838666432623162393037382e706e67)](https://camo.githubusercontent.com/8db2920a29da874acce744cbdb713bc06226da50ede6ac967380ddd280f8fab9/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732362f34313663393838382d376166392d313165332d393266362d3838666432623162393037382e706e67)

### Removing translations

[](#removing-translations)

To remove translations you can use the remove command which has the same syntax as the add command:

`php artisan translate:remove account upgrade`

[![4](https://camo.githubusercontent.com/330e545979d091aa52082ba478fa6f98bfe39113849f1b3519e9b993a5a5d385/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732382f34363965666164612d376166392d313165332d383462332d3866623565336536343862342e706e67)](https://camo.githubusercontent.com/330e545979d091aa52082ba478fa6f98bfe39113849f1b3519e9b993a5a5d385/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732382f34363965666164612d376166392d313165332d383462332d3866623565336536343862342e706e67)

### Clean up

[](#clean-up)

The clean up command will search your files for language strings which are no longer used.

`php artisan translate:cleanup`

[![5](https://camo.githubusercontent.com/fdfa6234192ef5be0a15920d9ced7887c6164fdf34fa91864a20e373dfe41da0/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732392f34626262396239302d376166392d313165332d383537312d6435666363663431386337342e706e67)](https://camo.githubusercontent.com/fdfa6234192ef5be0a15920d9ced7887c6164fdf34fa91864a20e373dfe41da0/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313133333935302f313839343732392f34626262396239302d376166392d313165332d383537312d6435666363663431386337342e706e67)

Foreach line that was not found, you will get a confirmation if you want to delete the line in question. In case you you don't want to confirm each line, you can add the `--silent` parameter.

`php artisan translate:cleanup --silent`

By default the clean up command will look through all your language files. In case you want to focus on one specific group, you can add the `--group="account"` parameter.

`php artisan translate:cleanup --group="account"`

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

[](#installation)

The package can be installed via Composer by requiring the "philo/laravel-translate": "~2.0" package in your project's composer.json.

```
{
    "require": {
        "laravel/framework": "5.*",
        "philo/laravel-translate": "~2.0"
    },
    "minimum-stability": "dev"
}

```

Next you need to add the service provider to app/config/app.php

```
'providers' => array(
    /*
     * Application Service Providers...
     */
    'Philo\Translate\TranslateServiceProvider',
)

```

Config
------

[](#config)

You can publish the config file in case you want to make some adjustments to the clean up command: `php artisan vendor:publish`

```
