public function langUpdate()
    {
        $path = skin_path('lang'.DS.$this->module->name).DS.app_locale().'.json';
        $data = file_exists($path) ? json_decode(file_get_contents($path), true) : [];

        $data = array_filter(array_merge($data, [
            $this->name => $this->title,
            $this->name.'#descr' => $this->attributes['descr'],
            'section.' . $this->section => request('section_lang', __('section.' . $this->section)),
            'legend.' . $this->fieldset => request('legend_lang', __('legend.' . $this->fieldset)),
        ]));

        ksort($data);

        $data = json_encode($data, JSON_UNESCAPED_UNICODE);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \RuntimeException(sprintf(
                'Translation file `%s` contains an invalid JSON structure.', $path
            ));
        }

        file_put_contents($path, $data);

        return $this;
    }
public function langUpdate()
    {
        $path = skin_path('lang'.DS.$this->module->name).DS.app_locale().'.json';
        $data = file_exists($path) ? json_decode(file_get_contents($path), true) : [];

        $data = array_filter(array_merge($data, [
            $this->name => $this->title,
            $this->name.'#descr' => $this->attributes['descr'],
            'section.' . $this->section => request('section_lang', __('section.' . $this->section)),
            'legend.' . $this->fieldset => request('legend_lang', __('legend.' . $this->fieldset)),
        ]));

        ksort($data);

        $data = json_encode($data, JSON_UNESCAPED_UNICODE);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \RuntimeException(sprintf(
                'Translation file `%s` contains an invalid JSON structure.', $path
            ));
        }

        file_put_contents($path, $data);

        return $this;
    }
public function langUpdate ( ) { $ path = skin_path ( 'lang' . DS . $ this -> module -> name ) . DS . app_locale ( ) . '.json' ; $ data = file_exists ( $ path ) ? json_decode ( file_get_contents ( $ path ) , true ) : [ ] ; $ data = array_filter ( array_merge ( $ data , [ $ this -> name => $ this -> title , $ this -> name . '#descr' => $ this -> attributes [ 'descr' ] , 'section.' . $ this -> section => request ( 'section_lang' , __ ( 'section.' . $ this -> section ) ) , 'legend.' . $ this -> fieldset => request ( 'legend_lang' , __ ( 'legend.' . $ this -> fieldset ) ) , ] ) ) ; ksort ( $ data ) ; $ data = json_encode ( $ data , JSON_UNESCAPED_UNICODE ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new \ RuntimeException ( sprintf ( 'Translation file `%s` contains an invalid JSON structure.' , $ path ) ) ; } file_put_contents ( $ path , $ data ) ; return $ this ; }
Update setting lang file with format json.
Update setting lang file with format json .