PHP code example of niyko / transpicious

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

    

niyko / transpicious example snippets


    'Transpicious' => Niyko\Transpicious\Transpicious::class

'aliases' => [
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View' => Illuminate\Support\Facade.................
        .......
        .......
        'Transpicious' => Niyko\Transpicious\Transpicious::class
],

     return Transpicious::translate('world');

     Transpicious::set_translate_to('es');   // es is the language code

    $config['composer_autoload'] = TRUE;

    
        use Niyko\Transpicious\Transpicious;
    

     use Niyko\Transpicious\Transpicious;

     return Transpicious::translate('world');

     use Niyko\Transpicious\Transpicious;

     Transpicious::set_translate_to('es');   // es is the language code

     use Niyko\Transpicious\Transpicious;


    $_DEFAULT_CONVERT_FROM = "en";	
    $_DEFAULT_CONVERT_TO = "en";

     Transpicious::translate('CONTENT', 'TRANSLATE TO', 'TRANSLATE FROM');

     Transpicious::translate('Friends don’t lie');                      // Returns Friends don’t lie
     Transpicious::translate('Friends don’t lie', 'es');                // Returns Los amigos no mienten
     Transpicious::translate('Los amigos no mienten', 'ch', 'es');      // Returns 朋友不撒谎
     Transpicious::translate('Los amigos no mienten', null, 'es');      // Returns Friends don’t lie

     Transpicious::set_translate_to('TRANSLATE TO');

     Transpicious::set_translate_to('es');
     echo Transpicious::translate('She‘s our friend and she‘s crazy.');
     
     // The output will be : Ella es nuestra amiga y está loca

     Transpicious::set_translate_to('es');
     echo Transpicious::translate('Mornings are for coffee and contemplation');
     echo Transpicious::translate('Mornings are for coffee and contemplation', 'ar');   // <= Note that translate() has a 2nd parameter
     
     /* The output will be :-
        Las mañanas son para el café y la contemplación.
        الصباح لتناول القهوة والتأمل
     */

     Transpicious::clear_cache();
``Html
    <body>
        <h1>{!! Transpicious::translate('hello') !!}</h1>
        <p>{!! Transpicious::translate('world') !!}</p>
    </body>
``Html
    <body>
        <h1> echo Transpicious::translate('hello') 
 echo Transpicious::translate('hello') 
 echo Transpicious::translate('world')