Configuration - Logaty

Configuration files Last updated: 26/12/2021

Find Config Files, Click on file to see content.

  • Config
    • options.php General Settings.
    • direction.php languages direction (ltr or rtl).
    • enabled.php enabled languages in your website.
    • flags.php language flag name (icon name en.png).
    • name.php Language Name ( Name in English & Natural Name ).
    • supported.php all languages supported in your website.
    • paths.php directory paths of (languages directory & flags directory).
    • code.php languages ISO-2 Codes - optional if you want to use it.

Get configuration values

How to use Configuration its easy to get configuration values!

<?php
    logaty()->config->get('file-name.option-you-need');

    // get default language
    echo logaty()->config->get('options.default_lang');

    // get direction for arabic language
    echo logaty()->config->get('direction.ar');


All options in (options.php) file you can retrieve value using options helper function

<?php
    logaty()->option('option-you-need');

    // get default language
    echo logaty()->option('default_lang');

    // check if detecting browser language is enabled
    if( logaty()->option('detect_browser_lang')
    {
        echo "Yes";
    }
    else
    {
        echo "NO";
    }


You can get configuration using Helpers

<?php
     // return -Array- All enabled languages
    logaty()->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

    <?php
        return [
            // 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
    */