PHP code example of headwires / translator-client

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

    

headwires / translator-client example snippets


{{ __('messages.welcome') }}
{{ __('messages.greeting', ['name' => $user->name]) }}

'projects' => [
    [
        'name' => 'main',
        'api_key' => env('CLI_TRANSLATOR_API_KEY'),
        'path' => resource_path('lang'),
        'scan_paths' => ['resources/views', 'app'],
    ],
    [
        'name' => 'package',
        'api_key' => env('CLI_TRANSLATOR_PACKAGE_API_KEY'),
        'path' => base_path('vendor/your-package/resources/lang'),
        'scan_paths' => ['vendor/your-package/resources/views'],
    ],
],

// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
    $schedule->command('translator:sync')
        ->hourly()
        ->withoutOverlapping();
}
bash
php artisan vendor:publish --tag=translator-client-config
bash
php artisan translator:sync
bash
php artisan translator:warmup
bash
php artisan translator:status
bash
php artisan translator:scan
bash
php artisan translator:sync --project=package
bash
php artisan translator:sync
php artisan translator:warmup  # if using live mode

resources/lang/
├── en/
│   ├── messages.php      # Managed by LangSyncer
│   ├── auth.php          # Managed by LangSyncer
│   └── custom.php        # Your local translations (safe)
└── es/
    ├── messages.php
    ├── auth.php
    └── custom.php