arispati/app-locale

Localization for Laravel and Lumen Framework
22,582 1
Install
composer require arispati/app-locale
Latest Version:v0.1.0
PHP:>=7.2
License:MIT
Last Updated:Aug 6, 2021
Links: GitHub  ·  Packagist
Maintainer: arispati

App Locale

Localization for Laravel and Lumen Framework

Description

This package will set the locale of the application by the request that contains the App-Locale attribute in the header

How to Install

  • Install with composer
composer require arispati/app-locale

Laravel

  • Register the middleware
// app/Http/Kernel.php
protected $middleware = [
    // ...
    \Arispati\AppLocale\Middleware\AppLocale::class
];

Lumen

  • Register the middleware
// bootstrap/app.php
$app->middleware([
    \Arispati\AppLocale\Middleware\AppLocale::class
]);
  • if you want to use Facade
// bootstrap/app.php

// Enabled Facade
$app->withFacades(true, [
    '\Arispati\AppLocale\Facades\AppLocale' => 'AppLocale'
]);

// Register service provider
$app->register(\Arispati\AppLocale\ServiceProvider::class);

Available Method

  • Set app locale
AppLocale::setLocale('id'); // set app locale to 'id' (Bahasa Indonesia)
  • Get app locale
AppLocale::getLocale();

Related Packages

douyasi/locator

Browser Preferred Language Detector

6,858 4
longman/laravel-multilang

Package to integrate multi language (multi locale) functionality in Laravel 5.x

14,636 54
vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains o...

578,979 109
torann/localization

Simple subdomain localization for Laravel.

5,708 2