astrotomic/laravel-translation

This package is abandoned and no longer maintained. The author suggests using the astrotomic/laravel-translatable package instead.

A Laravel 5 package that implements the Symfony Po-Translation lib.

v0.1-alpha 2016-09-29 13:31 UTC

This package is not auto-updated.

Last update: 2019-10-22 12:05:35 UTC


README

GitHub Author GitHub release GitHub license GitHub issues

Travis branch StyleCI Code Climate Code Climate Code Climate

This is a laravel wrapper for the Symfony PoTranslator. It comes with two global helper functions __() and _n().

Installation

composer.json "astrotomic/laravel-translation": "dev-master"

config/app.php

return [
    ...
    'providers' => [
        Astrotomic\Laravel\Translation\TranslatorServiceProvider::class,
    ],
    ...
    'aliases' => [
        'Trans' => Astrotomic\Laravel\Translation\Facades\TranslatorFacade::class,
    ],
    ...
];

console

composer update
artisan vendor:publish

Usage

To generate the po files you first have to compile all your views, PoEdit can't handle blade, to do this use the artisan command artisan view:compile. After this you can generate the po files and the proper header with artisan trans:po. To collect and translate all the strings use PoEdit.