Skip to content
Extended translation for Laravel 5
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
src
.gitattributes
.gitignore
.styleci.yml
LICENSE
README.md
TODO.md
composer.json
composer.lock

README.md

Extended lang translations for Laravel 5.3+

Translation support for 69 languages.

lang translations

StyleCI Total Downloads Latest Stable Version Latest Unstable Version License

Installation

To get the latest version of Lang Translations Library, simply require the project using Composer:

composer require andrey-helldar/lang-translations

Instead, you may of course manually update your require block and run composer update if you so choose:

{
    "require": {
        "andrey-helldar/lang-translations": "^2.0"
    }
}

For using package in the Laravel 5.3-5.5 (php >= 5.6.0 <=7.1.2), use ^1.0 version.

For using package in the Laravel 5.5-5.x (php >= 7.1.3), use ^2.0 version (default).

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php:

Helldar\LangTranslations\ServiceProvider::class,

Using

Important

The package replaces only certain files in your lang directories:

resources/lang/<lang>/auth.php
resources/lang/<lang>/buttons.php
resources/lang/<lang>/errors.php
resources/lang/<lang>/forms.php
resources/lang/<lang>/statuses.php
resources/lang/<lang>/titles.php

// or    
resources/lang/<lang>.json

He does not touch any other files.

When updating, the package reads your changes in the files and adds them to your own. This means that if you fill in the files yourself, the package will not remove anything from them.

Also, if you select a JSON file type, localization files will be automatically generated from existing translation files. JSON file will be sorted in alphabetical order.

Install translations

When executing the php artisan lang-translations:install command, need to pass a list of localizations as a parameters:

php artisan lang-translations:install en
php artisan lang-translations:install en de ru

If files do not exist in the destination folder, they will be created. And if the files exist, the console will ask you for a replacement.

Also, if the files exist and you do not want to agree each time, you can pass the attribute --force or its alias -f for forced replacement.

php artisan lang-translations:install en --force
php artisan lang-translations:install en -f

By default, php translation files are copied. If you want to install json-files, then use the --json key:

php artisan lang-translations:install en --json
php artisan lang-translations:install en -j

Update translations

When executing the php artisan lang-translations:update command, the package learns which localizations are installed in your application and will replace the matching files.

Command php artisan lang-translations:update is an alias of php artisan lang-translations:install {langs} --force.

And command for updating json files: php artisan lang-translations:update --json

Status of files

Check the TODO file to see the missing translations.

Copyright and License

Lang Translations was written by Andrey Helldar for the Laravel Framework 5.3 and later, and is released under the MIT License. See the LICENSE file for details.

You can’t perform that action at this time.