PHP code example of parfumix / laravel-localization

1. Go to this page and download the library: Download parfumix/laravel-localization library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

parfumix / laravel-localization example snippets


  'providers' => [
        // Add that line at the end of array ..
        'Localization\LocaleServiceProvider'
      ]  



namespace Your/Namespace;

use Localization\Detectable;

class YourDetector implements Detectable {

    public function detect($request) {
        // return founded locale .
    }

}


// Here we will try detect and set as prefix first url segment . if not founded will be set null and will try to detect from below detectors .
Route::group(['prefix' => Localization\get_detector_locale('request')], function() {
  
  Route::get('/', function() {
    return view('welcome.blade.php')
  })
  
});

Localization\get_locales() // return all registered locales in config file

Localization\get_default_locale() // will return default locale

Localization\get_active_locale() // will return active detected locale

Localization\format_locale() // format your locale and return formatter instance

  $ php composer.phar 

  $ php artisan vendor:publish

  $ php artisan vendor:publish