<commit_before><?php
namespace root\library\Translator\index;

final class Translator {
    
    private $defaultLanguage ='english', $langFileExtension = '.php', $languageArray = array();
    
    public function setDefaultLang($language){
        $this->defaultLanguage = $language;
        return 1;
    }
    
    public function setLangFileExtension($extension){
        $this->langFileExtension = $extension;
        return 1;
    }
    
    public function translate($keyWord, $fileName = null){
        if($fileName !== null)
             $this->loadLanguageFile($fileName);
        
        $result = isset($this->languageArray[$keyWord])?$this->languageArray[$keyWord]:null;
        return $result;
    }
    
    public function loadLanguageFile($fileName){
        global $registry;
        $fileAddress = FILE_PATH . '__rfolder' . DS . 'languages' . DS . $this->defaultLanguage . DS . $fileName . $this->langFileExtension;
        if(file_exists($fileAddress)){
            $this->languageArray = require_once $fileAddress;
            if(!is_array($this->languageArray)){
                $registry->error->reportError('The Returned Value From The Called Language File Is Not An Array!', __LINE__, __METHOD__, true);
                return;
            }
            return 1;
        }else{
            $registry->error->reportError('Wanted Language Package (File) Does Not Exists!', __LINE__, __METHOD__, true);
            return;
        }
    }
}<commit_msg>Some changes for ease of reading the codes for developer<commit_after><?php
namespace root\library\Translator\index;

final class Translator {
    
    private $defaultLanguage ='english', $langFileExtension = '.php', $languageArray = array();
    
    public function setDefaultLang($language){
        $this->defaultLanguage = $language;
        return 1;
    }
    
    public function setLangFileExtension($extension){
        $this->langFileExtension = $extension;
        return 1;
    }
    
    public function translate($keyWord, $fileName = null){
        
        if($fileName !== null){
             $this->loadLanguageFile($fileName);
        }
        
        return isset($this->languageArray[$keyWord])?$this->languageArray[$keyWord]:null;
    }
    
    public function loadLanguageFile($fileName){
        global $registry;
        $fileAddress = FILE_PATH . '__rfolder' . DS . 'languages' . DS . $this->defaultLanguage . DS . $fileName . $this->langFileExtension;
        
        if(file_exists($fileAddress)){
            $this->languageArray = require_once $fileAddress;
            
            if(!is_array($this->languageArray)){
                $registry->error->reportError('The Returned Value From The Called Language File Is Not An Array!', __LINE__, __METHOD__, true);
                return;
            }
            
            return 1;
        }
        
        else{
            $registry->error->reportError('Wanted Language Package (File) Does Not Exists!', __LINE__, __METHOD__, true);
            return;
        }
    }
}
{'fraction_non_alphanumeric': 0.11772443275238409, 'fraction_numerical': 0.0019730351857941467, 'mean_word_length': 2.3282275711159737, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5421809', 'n_tokens_mistral': 801, 'n_tokens_neox': 799, 'n_words': 185}