public function import(string $file): self
    {
        $loader = $this->getLoader();
        $loader->setDirectories($this->directories);

        $langFile = $loader->load($file);

        if (! isset($langFile['lang'])) {
            throw new InvalidArgumentException(\sprintf('File [%s] cant be imported. Key for language is missing.', $file));
        }

        $this->addMessageCatalogue(new MessageCatalogue($langFile['lang'], $langFile));

        return $this;
    }
public function import(string $file): self
    {
        $loader = $this->getLoader();
        $loader->setDirectories($this->directories);

        $langFile = $loader->load($file);

        if (! isset($langFile['lang'])) {
            throw new InvalidArgumentException(\sprintf('File [%s] cant be imported. Key for language is missing.', $file));
        }

        $this->addMessageCatalogue(new MessageCatalogue($langFile['lang'], $langFile));

        return $this;
    }
public function import ( string $ file ) : self { $ loader = $ this -> getLoader ( ) ; $ loader -> setDirectories ( $ this -> directories ) ; $ langFile = $ loader -> load ( $ file ) ; if ( ! isset ( $ langFile [ 'lang' ] ) ) { throw new InvalidArgumentException ( \ sprintf ( 'File [%s] cant be imported. Key for language is missing.' , $ file ) ) ; } $ this -> addMessageCatalogue ( new MessageCatalogue ( $ langFile [ 'lang' ] , $ langFile ) ) ; return $ this ; }
Import a language from file.

@param string $file

@throws \Viserio\Component\Contract\Translation\Exception\InvalidArgumentException

@return $this
Import a language from file .