rut2
rut2

Reputation: 706

How to get all languages data in codeigniter

I am trying to fetch all language files data and store them in array. But I am only able to get default language data.

I need all language data to sync them in another files. So far I have tried following code,

public function SyncJsLanguageFile($Language) {
    //I need German (de) and other data as well data
    $this->lang->load('translate','de');  

    //But I can only get default language data. So I think above line is not working. 
    $LanguageMessage = $this->lang->language;
    echo "<pre>";
    print_r($LanguageMessage);
    die;
}

I don't want to change default language, I just need all language data in array for specific purpose. I should not change Site default language.

Please help me out here.

I have tried,

$data = $this->lang->load('translate','de', TRUE);

but it is not working. :(

Upvotes: 1

Views: 2777

Answers (1)

phpashokkahsyap
phpashokkahsyap

Reputation: 71

Please do these steps

//load helper for language
$this->load->helper('language');
//mytest is the language file in english folder
//application\language\english\mytest_lang.php
$this->lang->load('mytest','english');// filename, folder name in  
//fetch all the data in your custom $all_lang_array variable
 $all_lang_array=$this->lang->language;
//display or test the data.

print_r( $all_lang_array);

Upvotes: 7

Related Questions