PHP code example of frmb / language

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

    

frmb / language example snippets


$di->setShared('language', function() use ($di){
    $language = new \Anax\Language\Language();
	$language->setDI($di);
    return $language;
});

$app->language->words('welcome_message'); 

class CommentController
{
	public function viewAction(){
		echo $this->language->words('commentcontroller_hello'); 
	}
}

$app->router->add('comment', function() use ($app) {
	$app->theme->setTitle($app->language->words( 'commentcontroller_hello', ['module' => 'CommentController']) );
	
	$app->views->add('comment/form', [
        'title' => , $app->language->words('commentcontroller_title'),
        'information' => $app->language->words('commentcontroller_information'),
    ]);
});

'home'  => [
    'text'  => $this->di->language->words('navbar_home', ['module' => 'navbar']),
    'url'   => $this->di->get('url')->create(''),
    'title' => 'Home route of current frontcontroller'
],
'comments'  => [
    'text'  => $this->di->language->words('navbar_comments),
    'url'   => $this->di->get('url')->create('comments'),
    'title' => 'Route to our Comment Controllers'
],

$app->views->add('me/hem', [
	'content' => $content . $app->language->words('welcome_message') . '<br/>' . $app->language->words('welcome_message', ['lang' => 'en']),
	'byline' => $byline . $app->language->words('byline'),
]);