phpbb\language\language_file_loader::load_file PHP Method

load_file() protected method

Prepares language file loading
protected load_file ( string $path, string $component, array $locale, array &$lang )
$path string Path to search for file in
$component string Name of the language component
$locale array Array containing language fallback options
$lang array Array reference of language strings
    protected function load_file($path, $component, $locale, &$lang)
    {
        // This is BC stuff and not the best idea as it makes language fallback
        // implementation quite hard like below.
        if (strpos($this->phpbb_root_path . $component, $path) === 0) {
            // Filter out the path
            $path_diff = str_replace($path, '', dirname($this->phpbb_root_path . $component));
            $language_file = basename($component, '.' . $this->php_ext);
            $component = '';
            // This step is needed to resolve language/en/subdir style $component
            // $path already points to the language base directory so we need to eliminate
            // the first directory from the path (that should be the language directory)
            $path_diff_parts = explode('/', $path_diff);
            if (sizeof($path_diff_parts) > 1) {
                array_shift($path_diff_parts);
                $component = implode('/', $path_diff_parts) . '/';
            }
            $component .= $language_file;
        }
        // Determine filename
        $filename = $component . '.' . $this->php_ext;
        // Determine path to file
        $file_path = $this->get_language_file_path($path, $filename, $locale);
        // Load language array
        $this->load_language_file($file_path, $lang);
    }