1. Go to this page and download the library: Download bedita/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.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bedita / i18n example snippets
$this->addPlugin('BEdita/I18n');
/*
* I18n configuration.
*/
Configure::write('I18n', [
// list of locales supported// locale => primary language code for that locale'locales' => [
'en_US' => 'en',
'it_IT' => 'it',
],
// default primary language code'default' => 'en',
// list of languages supported// primary language code => humanized language'languages' => [
'en' => 'English',
'it' => 'Italiano',
],
/** Middleware specific conf **/// array of URL paths, if there's an exact match rule is applied'match' => ['/'],
// array of URL paths, if current URL path starts with one of these rule is applied'startWith' => ['/help', '/about'],
//reserved URL (for example `/lang`) used to switch language and redirect to referer URL.'switchLangUrl' => '/lang',
// array for cookie that keeps the locale value. By default no cookie is used.'cookie' => [
'name' => 'i18n-lang', //cookie name'create' => true, // set to `true` if the middleware is responsible of cookie creation'expire' => '+1 year', // used when `create` is `true` to define when the cookie must expire
],
// session key where store the locale. Set null to disable (default)'sessionKey' => 'i18n-session-locale',
]);