Introduced new Data Transfer Objects (DTOs), exceptions, and jobs to enhance the translation service functionality. Updated namespaces for consistency and added rate limiting to the translation provider. Expanded the README with detailed usage instructions.
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php declare(strict_types=1);
 | 
						|
 | 
						|
/**
 | 
						|
 * Copyright (c) 2024
 | 
						|
 * author: Leonid Nikitin - i@kor-elf.net
 | 
						|
 * web: https://git.kor-elf.net/kor-elf
 | 
						|
 * Initial version created on: 15.09.2024
 | 
						|
 * MIT license: https://git.kor-elf.net/kor-elf/translate-laravel/src/branch/main/LICENSE
 | 
						|
 */
 | 
						|
 | 
						|
return [
 | 
						|
    /*
 | 
						|
    |--------------------------------------------------------------------------
 | 
						|
    | Default Translate Service
 | 
						|
    |--------------------------------------------------------------------------
 | 
						|
    |
 | 
						|
    | This option controls the default translate service that will be used by the
 | 
						|
    | framework. This connection is utilized if another isn't explicitly
 | 
						|
    | specified when running a translation operation inside the application.
 | 
						|
    |
 | 
						|
    */
 | 
						|
 | 
						|
    'default' => env('TRANSLATE_SERVICE', 'yandex'),
 | 
						|
 | 
						|
    'services' => [
 | 
						|
        'yandex' => [
 | 
						|
            'driver' => '\KorElf\TranslateLaravel\Translate\YandexDriver',
 | 
						|
            'config' => [
 | 
						|
                'folder_id'           => env('TRANSLATE_YANDEX_FOLDER_ID'),
 | 
						|
                'authorized_key_path' => base_path(env('TRANSLATE_YANDEX_AUTHORIZED_KEY_PATH')),
 | 
						|
                'limit' => [
 | 
						|
                    'max_request'  => (int) env('TRANSLATE_YANDEX_LIMIT_MAX_REQUEST', 20),
 | 
						|
                    'rate_seconds' => (int) env('TRANSLATE_YANDEX_LIMIT_RATE_SECONDS', 1),
 | 
						|
                    'max_symbols' => (int) env('TRANSLATE_YANDEX_LIMIT_MAX_SYMBOLS', 9000),
 | 
						|
                ],
 | 
						|
            ],
 | 
						|
        ],
 | 
						|
    ],
 | 
						|
];
 |