All Projects β†’ Propaganistas β†’ Laravel Intl

Propaganistas / Laravel Intl

Licence: mit
🚫 [ABANDONED] Easy to use internationalization/localization functions for Laravel 5

Projects that are alternatives of or similar to Laravel Intl

Xblock Kernel
XBlock - 开发文摣
Stars: ✭ 127 (-31.35%)
Mutual labels:  laravel, lumen
Laravel Awesome
Laravel ε­¦δΉ ε›Ύθ°±
Stars: ✭ 143 (-22.7%)
Mutual labels:  laravel, lumen
Vim Laravel
Vim support for Laravel/Lumen projects
Stars: ✭ 128 (-30.81%)
Mutual labels:  laravel, lumen
Lumen Microservice
Lumen on Docker - Skeleton project with Nginx, MySQL & PHP 7 | Aws ECS, Google Kubernates, Azure Container Engine
Stars: ✭ 183 (-1.08%)
Mutual labels:  laravel, lumen
Forrest
A Laravel library for Salesforce
Stars: ✭ 171 (-7.57%)
Mutual labels:  laravel, lumen
Taobao Top Client
Taobao top client(SDK) for laravel
Stars: ✭ 105 (-43.24%)
Mutual labels:  laravel, lumen
Laravel Fractal
An easy to use Fractal wrapper built for Laravel and Lumen applications
Stars: ✭ 1,748 (+844.86%)
Mutual labels:  laravel, lumen
Larafast Fastapi
A Fast Laravel package to help you generate CRUD API Controllers and Resources, Model.. etc
Stars: ✭ 91 (-50.81%)
Mutual labels:  laravel, lumen
Formatjs
The monorepo home to all of the FormatJS related libraries, most notably react-intl.
Stars: ✭ 12,869 (+6856.22%)
Mutual labels:  internationalization, intl
Arbify
ARB files localization tool. Dedicated to Flutter and its intl package.
Stars: ✭ 168 (-9.19%)
Mutual labels:  internationalization, intl
Larasupport
πŸ“¦ Adds Laravel Packages Support to Lumen and Vendor Publish Artisan Command.
Stars: ✭ 104 (-43.78%)
Mutual labels:  laravel, lumen
Laravel Source Encrypter
Laravel and Lumen Source Code Encrypter
Stars: ✭ 175 (-5.41%)
Mutual labels:  laravel, lumen
Eslint Plugin I18n Json
Fully extendable eslint plugin for JSON i18n translation files.
Stars: ✭ 101 (-45.41%)
Mutual labels:  internationalization, intl
Vue Lumen Starter
😎 VueJs & Lumen Api Starter.
Stars: ✭ 116 (-37.3%)
Mutual labels:  laravel, lumen
Laravel Aspect
aspect oriented programming Package for laravel framework
Stars: ✭ 98 (-47.03%)
Mutual labels:  laravel, lumen
Laravel Pug
Pug view adapter for Laravel and Lumen
Stars: ✭ 130 (-29.73%)
Mutual labels:  laravel, lumen
Laravel Url Shortener
Powerful URL shortening tools in Laravel
Stars: ✭ 80 (-56.76%)
Mutual labels:  laravel, lumen
Aura.intl
Internationalization tools, particularly message translation.
Stars: ✭ 82 (-55.68%)
Mutual labels:  internationalization, intl
Jquery.ime
jQuery based input methods library
Stars: ✭ 145 (-21.62%)
Mutual labels:  internationalization, intl
Laravel Http2 Server Push
A middleware package for Laravel to enable server push for your script, style, and image assets.
Stars: ✭ 174 (-5.95%)
Mutual labels:  laravel, lumen

Laravel Intl

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License

Easy to use internationalization functions for Laravel 5 and Lumen based on various libraries for easy retrieval of localized values and formatting of numeric values into their localized patterns.

Overview

Installation

Run the following command to install the latest version of the package

composer require propaganistas/laravel-intl

Laravel

If you don't use auto-discovery, open up your app config and add the Service Provider to the $providers array:

'providers' => [
   ...
   Propaganistas\LaravelIntl\IntlServiceProvider::class,
],

Lumen

In bootstrap/app.php, register the Service Provider

$app->register(Propaganistas\LaravelIntl\IntlServiceProvider::class);

Usage

Note: always use the helper functions or Facades, or make use of dependency injection.

Country

Output localized country names.

use Propaganistas\LaravelIntl\Facades\Country;

// Application locale: nl
Country::name('US'); // Verenigde Staten
Country::all(); // ['US' => 'Verenigde Staten', 'BE' => 'BelgiΓ«', ...]
// Application locale: en
country('US'); // United States
country()->all(); // ['US' => 'United States', 'BE' => 'Belgium', ...]

Currency

Output localized currency names and format currency amounts into their localized pattern.

use Propaganistas\LaravelIntl\Facades\Currency;

// Application locale: nl
Currency::name('USD'); // Amerikaanse dollar
Currency::symbol('USD'); // $
Currency::format(1000, 'USD'); // $ 1.000,00
Currency::formatAccounting(-1234, 'USD'); // (US$ 1.234,00)
Currency::all(); // ['USD' => 'Amerikaanse dollar', 'EUR' => 'Euro', ...]
// Application locale: en
currency('USD'); // US Dollar
currency()->symbol('USD'); // $
currency(1000, 'USD'); // $1,000.00
currency()->all(); // ['USD' => 'US Dollar', 'EUR' => 'Euro', ...]

Parse localized values into native PHP numbers.

use Propaganistas\LaravelIntl\Facades\Currency;

// Application locale: nl
Currency::parse('€ 1.234,50'); // 1234.5
// Application locale: nl
currency()->parse('€ 1.234,50'); // 1234.5

Date

Just use Illuminate\Support\Facades\Date.

Additional methods are also available to output localized common date formats. E.g. toShortDateString():

  • Locale "en": 1/31/2018
  • Locale "nl": 31-01-2018
use Illuminate\Support\Facades\Date;

$date = Date::now(); // or carbon()->now()

$date->toShortDateString();
$date->toMediumDateString();
$date->toLongDateString();
$date->toFullDateString();

$date->toShortTimeString();
$date->toMediumTimeString();
$date->toLongTimeString();
$date->toFullTimeString();

$date->toShortDatetimeString();
$date->toMediumDatetimeString();
$date->toLongDatetimeString();
$date->toFullDatetimeString();

Language

Output localized language names.

use Propaganistas\LaravelIntl\Facades\Language;

// Application locale: nl
Language::name('en'); // Engels
Language::all(); // ['en' => 'Engels', 'nl' => 'Nederlands', ...]
// Application locale: en
language('en'); // English
language()->all(); // ['en' => 'English', 'nl' => 'Dutch', ...]

Number

Output localized numeric values into their localized pattern.

use Propaganistas\LaravelIntl\Facades\Number;

// Application locale: en
Number::format(1000); // '1,000'
Number::percent('0.75'); // '75%'
// Application locale: fr
number(1000); // '1 000'
number()->percent('0.75'); // '75 %'

Parse localized values into native PHP numbers.

use Propaganistas\LaravelIntl\Facades\Number;

// Application locale: fr
Number::parse('1 000'); // 1000
number()->parse('1,5'); // 1.5

Changing locales

Ever feel the need to use a locale other than the current application locale? You can temporarily use another locale by using the usingLocale() method.

country()->name('US'); // United States

country()->usingLocale('nl', function($country) {
    return $country->name('US');
}); // Verenigde Staten

country()->name('US'); // United States

Alternatively, you can force each component individually to the preferred locale for the remainder of the application by calling the setLocale() on the helper function or Facade. Usually you'd set this in the boot() method of a ServiceProvider.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].