public function loadFromFile($pattern)
    {
        if (isset($this->files[$pattern])) {
            return $this;
        }

        $file = sprintf($pattern, $this->locale);
        if (!is_file($file)) {
            $defaultFile = sprintf($pattern, $this->defaultLocale);
            if (!is_file($defaultFile)) {
                throw new \InvalidArgumentException(sprintf('File "%s" and "%s" not found or not readable', $file, $defaultFile));
            } else {
                $file = $defaultFile;
            }
        }

        $this->files[$pattern] = true;

        return $this->loadFromArray(require $file);
    }
public function loadFromFile($pattern)
    {
        if (isset($this->files[$pattern])) {
            return $this;
        }

        $file = sprintf($pattern, $this->locale);
        if (!is_file($file)) {
            $defaultFile = sprintf($pattern, $this->defaultLocale);
            if (!is_file($defaultFile)) {
                throw new \InvalidArgumentException(sprintf('File "%s" and "%s" not found or not readable', $file, $defaultFile));
            } else {
                $file = $defaultFile;
            }
        }

        $this->files[$pattern] = true;

        return $this->loadFromArray(require $file);
    }
public function loadFromFile ( $ pattern ) { if ( isset ( $ this -> files [ $ pattern ] ) ) { return $ this ; } $ file = sprintf ( $ pattern , $ this -> locale ) ; if ( ! is_file ( $ file ) ) { $ defaultFile = sprintf ( $ pattern , $ this -> defaultLocale ) ; if ( ! is_file ( $ defaultFile ) ) { throw new \ InvalidArgumentException ( sprintf ( 'File "%s" and "%s" not found or not readable' , $ file , $ defaultFile ) ) ; } else { $ file = $ defaultFile ; } } $ this -> files [ $ pattern ] = true ; return $ this -> loadFromArray ( require $ file ) ; }
Loads translator messages from file

@param string $pattern The file path, which can contains %s that would be convert the current locale or fallback locale
@return $this
@throws \InvalidArgumentException When file not found or not readable
Loads translator messages from file