src/Services/PluginManager.php
private function publishLanguages($register)
    {
        // read language files from folder
        $langPath = $this->path . '/lang';
        if (!file_exists($langPath)) {
            return;
        }
        $files = [];
        list_files($files, $langPath, ['php'], false);

        // update manifest
        $manifest = $this->getManifest('languages');
        /** @noinspection PhpIncludeInspection */
        $list = file_exists($manifest) ? include $manifest : [];
        $basePathLength = strlen(base_path()) + 1;
        foreach ($files as $file) {
            $locale = basename($file, '.php');
            if ($register) {
                if (!isset($list[$locale])) {
                    $list[$locale] = [];
                }
                $list[$locale][$this->plugin] = substr($file, $basePathLength);
            }
            else {
                if (isset($list[$locale])) {
                    unset($list[$locale][$this->plugin]);
                    if (empty($list[$locale])) {
                        unset($list[$locale]);
                    }
                }
            }
        }
        $this->saveArray($manifest, $list);
    }
private function publishLanguages($register)
    {
        // read language files from folder
        $langPath = $this->path . '/lang';
        if (!file_exists($langPath)) {
            return;
        }
        $files = [];
        list_files($files, $langPath, ['php'], false);

        // update manifest
        $manifest = $this->getManifest('languages');
        /** @noinspection PhpIncludeInspection */
        $list = file_exists($manifest) ? include $manifest : [];
        $basePathLength = strlen(base_path()) + 1;
        foreach ($files as $file) {
            $locale = basename($file, '.php');
            if ($register) {
                if (!isset($list[$locale])) {
                    $list[$locale] = [];
                }
                $list[$locale][$this->plugin] = substr($file, $basePathLength);
            }
            else {
                if (isset($list[$locale])) {
                    unset($list[$locale][$this->plugin]);
                    if (empty($list[$locale])) {
                        unset($list[$locale]);
                    }
                }
            }
        }
        $this->saveArray($manifest, $list);
    }
private function publishLanguages ( $ register ) { // read language files from folder $ langPath = $ this -> path . '/lang' ; if ( ! file_exists ( $ langPath ) ) { return ; } $ files = [ ] ; list_files ( $ files , $ langPath , [ 'php' ] , false ) ; // update manifest $ manifest = $ this -> getManifest ( 'languages' ) ; /** @noinspection PhpIncludeInspection */ $ list = file_exists ( $ manifest ) ? include $ manifest : [ ] ; $ basePathLength = strlen ( base_path ( ) ) + 1 ; foreach ( $ files as $ file ) { $ locale = basename ( $ file , '.php' ) ; if ( $ register ) { if ( ! isset ( $ list [ $ locale ] ) ) { $ list [ $ locale ] = [ ] ; } $ list [ $ locale ] [ $ this -> plugin ] = substr ( $ file , $ basePathLength ) ; } else { if ( isset ( $ list [ $ locale ] ) ) { unset ( $ list [ $ locale ] [ $ this -> plugin ] ) ; if ( empty ( $ list [ $ locale ] ) ) { unset ( $ list [ $ locale ] ) ; } } } } $ this -> saveArray ( $ manifest , $ list ) ; }
Update the language files.

@param bool $register
Update the language files .