2017 © Pedro Peláez
 

library localization

Easy i18n localization for Laravel 4.

image

borges/localization

Easy i18n localization for Laravel 4.

  • Wednesday, June 4, 2014
  • by mapb_1990
  • Repository
  • 1 Watchers
  • 7 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Localization

Easy i18n localization for Laravel 4., (*1)

Instalation

In app/config/app.php, replace the following entry from the providers key:, (*2)

'Illuminate\Translation\TranslationServiceProvider',

with:, (*3)

'Borges\Localization\LocalizationServiceProvider',

and add the next facade in the aliases key:, (*4)

'Locale'          => 'Borges\Localization\Facades\Locale',

You may publish the package's configuration if you so choose, using artisan CLI:, (*5)

php artisan config:publish borges/localization

Usage

Translation

This translations package is designed to adapt to your workflow. Translations are accessed just like in Laravel, with replacements and pluralization working as expected. The only difference is that languages ​​can be inherited., (*6)

Example

app/en/app.php, (*7)

return array(
    'color'     => 'Colour',
    'hello'     => 'Hello',
    'welcome'   => 'Welcome',
    'another-string' => 'Another String'
);

app/en-US/app.php, (*8)

return array(
    'color'     => 'Color'
);

app/pt/app.php, (*9)

return array(
    'color'     => 'Cor',
    'hello'     => 'Olá',
    'welcome'   => 'Bem-vindo'
);
App::setLocale('en');
echo Lang::get('app.welcome');  # prints 'Welcome'
echo Lang::get('app.color');  # prints 'Colour'
echo Lang::get('app.hello');  # prints 'Hello'

App::setLocale('en-US');
echo Lang::get('app.welcome');  # prints 'Welcome'
echo Lang::get('app.color');  # prints 'Color'
echo Lang::get('app.hello');  # prints 'Hello'

App::setLocale('pt');
echo Lang::get('app.welcome');  # prints 'Bem-vindo'
echo Lang::get('app.color');  # prints 'Cor'
echo Lang::get('app.hello');  # prints 'Olá'

echo Lang::get('another-string');  # prints 'Another String' if 'useDefault' is true or else prints 'another-string'

Another resources (dates, numbers, ...)

This package provides a local resource formatter for dates and numbers., (*10)

Example

App::setLocale('en');
echo Locale::number(1234567.890); # prints '1, 234, 567.89'
echo Locale::int(1234567.890); # prints '1, 234, 568'
echo Locale::date(Carbon\Carbon::now()); # prints 'Tuesday, December 17, 2013'

App::setLocale('en-US');
echo Locale::number(1234567.890); # prints '1, 234, 567.89'
echo Locale::int(1234567.890); # prints '1, 234, 568'
echo Locale::date(Carbon\Carbon::now()); # prints 'Tuesday, December 17, 2013'

App::setLocale('pt');
echo Locale::number(1234567.890); # prints '1 234 567,89'
echo Locale::int(1234567.890); # prints '1 234 568'
echo Locale::date(Carbon\Carbon::now()); # prints '17 de Dezembro de 2013'

Helpers

This package provides a collection of helpers functions. See helpers.php., (*11)

Changelog

v0.1.0 (17-12-2013)

  • Initial release

Support or Contact

If you have any questions or found any bug, please contact me via twitter or github issues system., (*12)

Support via PayPal, (*13)

The Versions

04/06 2014

dev-master

9999999-dev https://github.com/mapb1990/Laravel-Localization-Module/

Easy i18n localization for Laravel 4.

  Sources   Download

MIT

The Requires

 

laravel translation i18n localization laravel4 borges

27/12 2013

0.1.0

0.1.0.0 https://github.com/mapb1990/Laravel-Localization-Module/

Easy i18n localization for Laravel 4.

  Sources   Download

MIT

The Requires

 

laravel translation i18n localization borges