PHP code example of in10 / multilanguage

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

    

in10 / multilanguage example snippets


Route::multilanguage([], function() {
    Route::get('/', 'HomepageController')->name('homepage');
    Route::get('/news/{slug}', 'HomepageController')->name('news.show');
});

Route::multilanguage([], function() {
    Route::transGet('news.show');
});

// resources/lang/en/routes.php
return [
    'news.show' => 'news/{slug}',
];

// resources/lang/nl/routes.php
return [
    'news.show' => 'nieuws/{slug}',
];

function translatedRoute(string $route, array $parameters = [], bool $absolute = true, ?string $language = null) : string

translatedRoute('news.show', ['slug' => 'five-ways-to-translate-content');
bash
php artisan vendor:publish --provider=IN10\\Multilanguage\\ServiceProvider