Hobby99
Hobby99

Reputation: 703

Update language array in language file

I have displayed the array of the language files in my admin panel with

Lang::get('site');

Is there also something like

Lang::set(); 

so I can update the language array values in the language file?

I have an array now with the keys of the language file together with the newly inputed values. What is the (easiest) way in Laravel to update the values in the language file? Thanks for sharing!

function postUpdate() {
    $lang_input = Input::all();
    $lang_original = Lang::get('site');
    $array = array();
    foreach($lang_orig as $key => $value){
        array_unshift($array, $key);
    }
    $merged = array_combine($array, $lang_input);
    ??????Lang::set();??????
}

Upvotes: 0

Views: 1213

Answers (1)

Matthew
Matthew

Reputation: 44

There is no Lang::set() as of 4.2, but there are existing packages to help you with this: https://github.com/Waavi/translation

Upvotes: 2

Related Questions