2017 © Pedro Peláez
 

library lari18n

A live internationalisation edition tool for laravel

image

nicolasbeauvais/lari18n

A live internationalisation edition tool for laravel

  • Monday, January 26, 2015
  • by nicolasbeauvais
  • Repository
  • 1 Watchers
  • 2 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Lari18n (Beta)

Translation made easy, (*1)

Lari18n provide an easy to use graphical interface to interact with each translated text., (*2)

Description

Did you ever experienced the struggle of translating a website ? Well, maybe not, a PHP array is probably really easy to read for you !, (*3)

But in most case the translation is made by non technical profile, like a proffessional translator. Unfortunately,a large portion of them do not know PHP array., (*4)

Sure, they can learn how it work, or you can generate some po files, but where is the context in that ?, (*5)

return array(
    'previous' => '« Previous',
    'next'     => 'Next »',
);

What if we can gave them a tool to translate a whole website without touching any PHP file and with a full context of the translation ?, (*6)

This is the goal of Lari18n, (*7)

Demo

Lari18n Toolbar

toolbar-demo, (*8)

Lari18n translation overlay

overlay-demo, (*9)

Installation

Composer

To install Lari18n as a Composer package to be used with Laravel 4, simply add this to your composer.json:, (*10)

  "nicolasbeauvais/lari18n": "dev-master"

Publish

To let your app use the front end ressource of Lari18n you need to publish them to your app using this artisan command for the assets, (*11)

  php artisan asset:publish nicolasbeauvais/lari18n

and use this command for the views, (*12)

  php artisan view:publish nicolasbeauvais/lari18n

Setup

You should comment (or remove) the laravel translation service provider and use lari18n instead, (*13)

  'providers' => array(
      // ...
      //'Illuminate\Translation\TranslationServiceProvider',
      // ...
      'Nicolasbeauvais\Lari18n\Lari18nServiceProvider'
  ),

Using Lari18n

Lari18n help you to archieve a new translation process, for that you must use the native laravel localization system, and your app base language (falback_locale) translation files must be up to date., (*14)

To activate Lari18n you can use the activate method. For example in a filter for a specific role of your application., (*15)

\Nicolasbeauvais\Lari18n\Lari18n::activate();

Now, every time you use trans() or Lang::get() lari18n will be able to do some magic work., (*16)

But how to choose which translation you want to perform ?

Lari18n use the app.fallback_locale as the reference language and the app.locale as the language to translate., (*17)

New Translation

Lari18n is packed with a artisan command to help you in the translation process. This command create a new locale directory with all the translation files ready to be translated with Lari18n., (*18)

  php artisan lari18n:new [from_locale] [to_locale]

Translation changes

You can watch your translations directory using gulp or grunt and apply the update command on file change, (*19)

  php artisan lari18n:update

This command will update all other locales files with the additions made on the fallback locale files., (*20)

If you also want to remove the entry that doesn't exist in your fallback locale you can use the remove option, (*21)

  php artisan lari18n:update --remove

License

This Laravel package is open-sourced licensed under the MIT license, (*22)

The Versions

26/01 2015

dev-master

9999999-dev https://github.com/nicolasbeauvais/lari18n

A live internationalisation edition tool for laravel

  Sources   Download

MIT

The Requires

 

laravel translation i18n laravel4 translate live