PHP code example of hyperf / translation

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

    

hyperf / translation example snippets



declare(strict_types=1);

return [
    'locale' => 'en',   
    'fallback_locale' => '',
    'path' => BASE_PATH . '/storage/languages', 
];

$container = ApplicationContext::getContainer();
$translator = $container->get(\Hyperf\Contract\TranslatorInterface::class);
$translator->trans('validation.accepted');
bash
php bin/hyperf.php vendor:publish hyperf/translation

+ ./config/autoload/translation.php