PHP code example of deployteam / laravel-polytranslate

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

    

deployteam / laravel-polytranslate example snippets


DeployTeam\PolyTranslate\ServiceProvider::class,

'PolyTranslate' => DeployTeam\PolyTranslate\Facade::class,

PolyTranslate::addPath(['themes/base/lang', 'themes/child/lang']); // without namespace
PolyTranslate::addNamespace('theme', ['themes/base/lang', 'themes/child/lang']); // with namespace

// themes/base/lang/en/header.php
return [
    'greetings' => 'Hello',
    'login' => 'Login'
];

// themes/child/lang/en/header.php
return [
    'login' => 'Authenticate',
    'register' => 'Register'
];

[
    'greetings' => 'Hello',
    'login' => 'Authenticate',
    'register' => 'Register'
]