name.phpLanguage Name ( Name in English & Natural Name ).
supported.phpall languages supported in your website.
paths.phpdirectory paths of (languages directory & flags directory).
code.phplanguages ISO-2 Codes - optional if you want to use it.
<?php/**
* Library Options
*/return[/** Default Language in your website */'default_lang'=>'en',/** if you want to enable detect visitor browser language */'detect_browser_lang'=>true,/** if you want to enable detect visitor country language */'detect_country_lang'=>false,/**
enable(true) if ypu want to hide language parameter
from url if selected language is default language
*/'hide_default_language'=>true,/** language parameter in url name */'lang_key'=>'lang',/**
if you want to hide untranslated content
- advanced using when connect library with database -
*/'hide_untranslated'=>true,/**
if you want to alert user about untranslated content
(hide_untranslated must be false)
- advanced using when connect library with database -
*/'alert_user_available_lang'=>true,];
<?php/**
* language direction
*/return[// 'lang-code' => 'direction''ar'=>'rtl',// arabic language is -right to left- then rtl'en'=>'ltr',// english language is -left to right- then ltr// you can add all languages supported in your website'es'=>'ltr','de'=>'ltr',];
<?php/**
* enabled languages in application
*/// all enabled languages in your websitereturn[0=>'ar',1=>'en',2=>'de'// you can add all languages you need];
<?php/**
* flag name with extension
*/// flag image name with extension (png, svg, ...etc)return[// 'language-code' => 'flag-name.ext''ar'=>'ps.png','en'=>'en.png','de'=>'de.png','fr'=>'fr.png','pt'=>'pt.png','ro'=>'ro.png',];
<?php/**
* Language name in english and natural
*/return['english'=>[// 'language-code' => 'language name in english''ar'=>'Arabic','en'=>'English','de'=>'German','fr'=>'French','pt'=>'Portuguese','ro'=>'Romanian','es'=>'Spain',],'natural'=>[// 'language-code' => 'natural language name''ar'=>'العربية','en'=>'English','es'=>'España','de'=>'Deutsch','fr'=>'Français','pt'=>'Português','ro'=>'Română',],];
<?php/**
* Supported language in application
*/// all languages supported in your website// supported languages not mean its enabled//return[0=>'ar',1=>'en',2=>'de',3=>'fr',4=>'pt',5=>'es',6=>'ro',];
<?php/**
* directory paths for (languages and flags)
*/return[// translation files directory'lang_files'=>__DIR__.'/../local/languages/',// flags images directory'flags'=>__DIR__.'/../local/flags/',];
<?php/**
* Languages local code 4-digits
optional config we dont use it any where!
*/return['ar'=>'ar','en'=>'en-US','de'=>'de_DE','fr'=>'fr_FR','pt'=>'es_ES','ro'=>'ro_RO','te'=>'te-TE',];
Get configuration values
How to use Configuration its easy to get configuration values!
<?phplogaty()->config->get('file-name.option-you-need');// get default languageechologaty()->config->get('options.default_lang');// get direction for arabic languageechologaty()->config->get('direction.ar');
All options in (options.php) file you can retrieve value using options helper function
<?phplogaty()->option('option-you-need');// get default languageechologaty()->option('default_lang');// check if detecting browser language is enabledif(logaty()->option('detect_browser_lang'){echo"Yes";}else{echo"NO";}
<?php// return -Array- All enabled languageslogaty()->enabled();// check if english language is enabled return -Bool-logaty()->isEnabled('en');// get english language direction return -string (rtl, ltr)-logaty()->direction('en');
Create Your Own Configuration
you can create extra configurations if your application (website) need
Create Config File
inside LOGATY directory go to -/config/- directory & create php file called what you want.
for example I will create file called extra.php
<?phpreturn[// languages we a help hand to translate website to 'need-to-trans'=>['ar','es'],'foo'=>'bar'];
retrieve config
get values fro your extra config
logaty()->config->get('extra.need-to-trans');/*
this code will return an array
array : ar, es
*/
logaty()->config->get('extra.foo');/*
this code will return string
string : bar
*/