PHP code example of parfumix / laravel-translator

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

    

parfumix / laravel-translator example snippets


  'providers' => [
        // Add that line at the end of array ..
        'Translator\TranslatorServiceProvider'
      ]  

 __($key, $replacement, $locale = null) // will translate your key based on default selected driver. Locale will grab automaticly from localization component.



namespace My\Namespace;

use Translator\Driver;
use Translator\Translatable;

class MyDriver extends Driver implements Translatable {

    // Get translation by key .
    public function get($key, $replacement = array(), $locale = null);

    // Check if has translation by key .
    public function has($key, $locale = null);
    
    // Delete translation by key .
    public function delete($key, $group, $locale = null);
    
    // Save your translation to source .
    public function translate($key, $translation, $locale = null);

}

  $ php composer.phar 

  $ php artisan vendor:publish

  $ php artisan vendor:publish