PHP code example of xelax90 / zf2-language-route

1. Go to this page and download the library: Download xelax90/zf2-language-route 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/ */

    

xelax90 / zf2-language-route example snippets


$locale = $this->getEvent()->getRouteMatch()->getParam('locale');

$this->url()->fromRoute('home', ['locale' => 'de_DE']); // will point to /de
$this->url()->fromRoute('home', ['locale' => 'en_US']); // will point to /en

echo $this->languageSwitch($renderMode, $currentLocale, $options);