2017 © Pedro Peláez
 

library linguo

Laravel Gettext integration

image

backtheweb/linguo

Laravel Gettext integration

  • Monday, February 5, 2018
  • by backtheweb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

linguo

Gettext for laravel 5, (*1)

Installation

Laravel Service Provider

Add the service provider and the face on config/app.php, (*2)

'providers' => [

    [...]
    Backtheweb\Linguo\LinguoServiceProvider::class,
],

'aliases' => [
    [...]
    'Linguo' => Backtheweb\Linguo\LinguoFacade::class,
]

And publish the config:, (*3)

php artisan vendor:publish --provider="Backtheweb\Linguo\LinguoServiceProvider" --tag=config

Setup

Edit config/linguo.php, (*4)

return [

    'headers' => [
        'Project-Id-Version'    => 'linguo',
        'Language-Team'         => 'TeamName <info@example.com>'
    ],

    'sources' => [
        base_path('resources/views'),
        base_path('app/Http/Controllers'),
    ] ,

    'i18nPath'  => base_path('resources/lang'),
    'domain'    => 'default',           // defualt domain
    'domains'   => [],                  // others domains to process
    'locales'   => ['es', 'en'],        // may be en or en_GB
];

Sources : Is where the parser will be looking for translation keys i18nPath: Is the path where are stored the translation files, (*5)

Parse and generate translation files

Parse

php artisian linguo:parse --compile

Compile

php artisian linguo:parse

What does it do?

  1. Read the folders defined on sources config and extract the keys form translation functions gettext, ngettext, __, _n
  2. Create a catalog default.pot file whit keys.
  3. Foreach language defined on locales:, (*6)

    • Create or/update the {local}/default.po file.
    • Create a {local}/default.php file with translations defined on {local}/default.po

The Versions

05/02 2018

dev-master

9999999-dev

Laravel Gettext integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jordi Touza Bonnin

27/07 2017

dev-dev

dev-dev

Laravel Gettext integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jordi Touza Bonnin