PHP code example of rougin / transcribe

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

    

rougin / transcribe example snippets

 php
// locales/fil_PH.php

$texts = array();

$texts['language'] = 'linguahe';
$texts['name'] = 'pangalan';
$texts['school'] = 'paaralan';

return $texts;
 php
// index.php

use Rougin\Transcribe\Source\DirectorySource;
use Rougin\Transcribe\Transcribe;

// Specify the localization source ---
$path = (string) __DIR__ . '/locales';

$source = new DirectorySource($path);
// -----------------------------------

$transcribe = new Transcribe($source);
 php
// index.php

use Rougin\Transcribe\Source\DirectorySource;
use Rougin\Transcribe\Transcribe;

// Create a PDO instance -----------------
$dsn = 'mysql:host=localhost;dbname=demo';

$pdo = new PDO($dsn, 'root', '');
// ---------------------------------------

// Specify the fields from the table ---
$table = array('name' => 'words');
$table['language'] = 'language';
$table['translation'] = 'translation';
$table['text'] = 'text';
// -------------------------------------

$source = new DatabaseSource($pdo, $table);

$transcribe = new Transcribe($source);
 php
namespace Rougin\Transcribe\Source;

interface SourceInterface
{
    /**
     * Returns an array of words.
     *
     * @return array
     */
    public function words();
}