<?php

(defined('BASEPATH')) OR exit('No direct script access allowed');

/* load the MX_Loader class */
require realpath('vendor/ciext/hmvc/third_party/MX/Lang.php');

class RT_Lang extends MX_Lang
{

    public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '')
    {
        // Temporary solution, will be removed in future
        $idiom = ($lang == '') ? CI::$APP->config->item('language') : $lang;
        if (strpos($langfile, '/') !== false && !in_array($idiom, ['english', 'ukrainian', 'russian'])) {
            $lang = 'english';
        }

        return parent::load($langfile, $lang, $return, $add_suffix, $alt_path, $_module);
    }

    public function line($line, $log_errors = true)
    {
        return (!isset($this->language[$line])) ? $line : parent::line($line, $log_errors);
    }

}
