Ejemplo n.º 1
0
 public function testSetTextDomainReturnsL4gettextInstance()
 {
     $textdomain = Config::get('l4gettext::config.textdomain');
     $path_to_mo = Config::get('l4gettext::config.path_to_mo');
     $this->assertInstanceOf('Netson\\L4gettext\\L4gettext', L4gettext::setTextDomain($textdomain, $path_to_mo));
 }
Ejemplo n.º 2
0
<?php

/*
|--------------------------------------------------------------------------
| netson/l4gettext Routes
|--------------------------------------------------------------------------
*/
Route::get('set-locale/{locale}', function ($locale) {
    // set locale
    L4gettext::setLocale($locale);
    // redirect to referrer or home
    if (Request::server('HTTP_REFERER')) {
        return Redirect::to($_SERVER['HTTP_REFERER']);
    } else {
        return Redirect::to('/');
    }
});
Route::get('set-encoding/{encoding}', function ($encoding) {
    // set encoding
    L4gettext::setEncoding($encoding);
    // redirect to referrer or home
    if (Request::server('HTTP_REFERER')) {
        return Redirect::to($_SERVER['HTTP_REFERER']);
    } else {
        return Redirect::to('/');
    }
});