PHP code example of wedesignit / laravel-translations-import

1. Go to this page and download the library: Download wedesignit/laravel-translations-import 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/ */

    

wedesignit / laravel-translations-import example snippets


// admin/employers.php
'datatables' => [
    'filter' => [
        'statuses' => [
            'active' => 'Actief',
            'not-active' => 'Inactief',
            'approved' => 'Goedgekeurd',
            'declined' => 'Afgekeurd',
        ],
    ],
];



return [
    /**
     * The table where the translations are stored
     */
    'table' => 'language_lines',

    /**
     * The column where the translations group should be stored
     */
    'group' => 'group',

    /**
     * The column where the translation key should be stored
     */
    'key' => 'key',

    /**
     * The column where the translation text itself should be stored
     */
    'translations' => 'text',

    /**
     * Array of functions which are used to get translations
     */
    'trans_functions' => [
        'trans',
        'trans_choice',
        'Lang::get',
        'Lang::choice',
        'Lang::trans',
        'Lang::transChoice',
        '@lang',
        '@choice',
        '__',
        '$trans.get',
    ],
];

php artisan translations:export

php artisan translations:find
blade
@foreach(__('admin/employers.datatables.filter.statuses') as $value => $translation)
    <option value="{{$value}}">{{$translation}}</option>
@endforeach

php artisan translations:clean

php artisan translations:nuke
bash
php artisan vendor:publish --provider="WeDesignIt\LaravelTranslationsImport\TranslationsImportServiceProvider" --tag="config"