PHP code example of torskint / auto-translate

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

    

torskint / auto-translate example snippets


'providers' => [
    // ...
    \Torskint\AutoTranslate\AutoTranslateServiceProvider::class,
],

'base_locale' => 'fr',

'locales' => [
    'en', 'de', 'es', 'it', 'ru', 'el', 'tr', 'pl', 'pt',
    'sv', 'fi', 'nl', 'hu', 'ro', 'sk', 'sq', 'sl', 'bg',
    'da', 'no', 'lv', 'lt', 'et', 'hr', 'mn', 'uz', 'ky',
    'hy', 'kk', 'tg', 'lb',
],

'files' => [
    'torskint/privacy-policy.php',
    'torskint/terms-and-conditions-of-use.php',
    'torskint/cookie-policy.php',
    'torskint/legal-notice.php',
],

'preserve_words' => [
    '(WEBSITE_NAME)', '(WEBSITE_EMAIL)', '(WEBSITE_PHONE)',
    '(AUTHOR_NAME)', '(AUTHOR_EMAIL)', '(TEAG)',
    '(PDF)', '({{filesize}}MiB)', '{{maxFilesize}}MiB', '{{statusCode}}',
    '\\', '%s', '%d',
],

'preserve_words_pattern' => '/\(\w+\)|%s|%d|\\\\|\(PDF\)|\(\{\{[a-zA-Z0-9_]+\}\}MiB\)|\{\{[a-zA-Z0-9_]+\}\}MiB|\{\{[a-zA-Z0-9_]+\}\}/',

'to_replace' => [
    'es' => [
        '(NOMBRE_SITIO WEB)'    => '(WEBSITE_NAME)',
        '(SITIO WEB_TELÉFONO)'  => '(WEBSITE_PHONE)',
    ],
    'el' => [
        '(ΤΕΑΓ)' => '(TEAG)',
    ],
    'ru' => [
        '(ИМЯ_ВЕБ-САЙТА)' => '(WEBSITE_NAME)',
    ],
],
bash
php artisan vendor:publish --tag=auto-translate-config
bash
php artisan ts-translate:reset
bash
php artisan ts-translate:count