PHP code example of stantabcorp / i18n

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

    

stantabcorp / i18n example snippets


$i18n->get("index_in_your_file");

$i18n->get("section_name[index_in_your_file]");
// OR
$i18n->get("section_name.index_in_your_file");

$i18n->getLang();

$i18n->setLang("language");

$i18n->replace("string", [
    "string" => "strong"
]);

$i18n->setFolder("path/to/the/new/folder");

$i18n->getFolder();

$i18n->setAvailableLanguages(array);

$i18n->getAvailableLanguage();

$i18n->setDefaultLanguage("string");
$i18n->getDefaultLanguage();

$i18nTwig = new i18nTwigExtension($i18n); // $i18n should be an instance of i18n\i18n
$twig->addExtension($i18nTwig);

$i18n = new i18n("en", "en", ["en", "fr"])