2017 © Pedro Peláez
 

library laravel-js-localization

Laravel Localization in JavaScript

image

xaoc/laravel-js-localization

Laravel Localization in JavaScript

  • Monday, January 29, 2018
  • by xAoc
  • Repository
  • 2 Watchers
  • 4 Stars
  • 4,830 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 100 Forks
  • 0 Open issues
  • 4 Versions
  • 6 % Grown

The README.md

Laravel JS Localization

Laravel Localization in JavaScript., (*1)

This is a simple package that convert all your localization messages of your Laravel app to JavaScript, and provides a small JavaScript library to interact with those messages., (*2)

For larvel 4.* use https://github.com/rmariuzzo/Laravel-JS-Localization, (*3)

Support Laravel 5.0., (*4)

Installation

Add the following line to you composer.json file under require., (*5)

"xaoc/laravel-js-localization": "dev-master"

Run:, (*6)

composer update

In your Laravel app go to config/app.php and add the following service provider:, (*7)

'providers' => array(
    ...
    'Mariuzzo\LaravelJsLocalization\LaravelJsLocalizationServiceProvider'
    ...
)

That's it!, (*8)

Usage

This project comes with a command that generate the JavaScript version of all your messages found at: app/lang directory. The resulting JavaScript file will have the whole bunch of messages and a thin library similar to Laravel's Lang class., (*9)

Generating JS messages, (*10)

php artisan lang:js

Specifying a custom target, (*11)

php artisan lang:js public/assets/dist/lang.dist.js

Compressing the JS file, (*12)

php artisan lang:js -c

Documentation

This is the documentation regarding the thin JavaScript library. The library highly inspired on Laravel's Lang class., (*13)

Getting a message, (*14)

Lang.get('messages.home');

Getting a message with replacements, (*15)

Lang.get('messages.welcome', { name: 'Joe' });

Changing the locale, (*16)

Lang.setLocale('es');

Checking if a message key exists, (*17)

Lang.has('messages.foo');

Support for singular and plural message based on a count, (*18)

Lang.choice('messages.apples', 10);

Calling the choice method with replacements, (*19)

Lang.choice('messages.apples', 10, { name: 'Joe' });    

For more detailed information, take a look at the source: Lang.js., (*20)

The Versions

29/01 2018

dev-master

9999999-dev https://github.com/xAockd/laravel-js-localization

Laravel Localization in JavaScript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel javascript js i18n localization laravel 5 lang

20/05 2014
15/05 2014
01/05 2014