PHP code example of devwizardhq / laravel-localizer
1. Go to this page and download the library: Download devwizardhq/laravel-localizer 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/ */
use DevWizard\Localizer\Facades\Localizer;
// Create a new locale
Localizer::create('fr', fromLocale: 'en');
// Get all translations (JSON + PHP combined)
$translations = Localizer::get('en');
// Get JSON translations only
$jsonTranslations = Localizer::getJson('en');
// Set a JSON translation
Localizer::set('welcome', 'Welcome!', 'en');
// Set nested PHP translation
Localizer::setPhp('validation.