Read a language string from the file.

@return void
512804
private function readLangString()
    {
        while (!$this->tokenIs(';')) {
            $this->getNextToken();

            if ($this->tokenIs('[')) {
                $this->subParserSquareBracket();
                continue;
            }
            if ($this->tokenIs('=')) {
                // right hand of the assignment.
                $this->getNextToken();

                if ($this->tokenIs(T_ARRAY) || $this->tokenIs('[')) {
                    $arrayParser = new ArrayParser($this, 1);
                    $arrayParser->parse();
                    $this->debug('After array. ' . var_export($this->getToken(), true));
                } else {
                    $subparser = new StringValue($this);
                    $subparser->parse();

                    $this->file->setValue(implode('.', $this->keystack), $subparser->getValue());
                }

                continue;
            }
            if (!$this->tokenIs(']')) {
                $this->bailUnexpectedToken();
            }
        }

        if ($this->tokenIs(';')) {
            // Reset stack.
            $this->resetStack();
        }
    }
824992
public function readChar()
    {
        if ($this->buffer === null) {
            // Buffer is empty, fill it ...
            $read = $this->in->read($this->bufferSize);
            if ($read === -1) {
                $ch = -1;
            } else {
                $this->buffer = $read;

                return $this->readChar(); // recurse
            }
        } else {
            // Get next buffered char ...
            // handle case where buffer is read-in, but is empty.  The next readChar() will return -1 EOF,
            // so we just return empty string (char) at this point.  (Probably could also return -1 ...?)
            $ch = ($this->buffer !== "") ? $this->buffer{$this->bufferPos} : '';
            $this->bufferPos++;
            if ($this->bufferPos >= strlen($this->buffer)) {
                $this->buffer = null;
                $this->bufferPos = 0;
            }
        }

        return $ch;
    }
324932
private function read()
    {
        $this->lock();

        $data = '';

        rewind($this->handle);

        $data = trim(stream_get_contents($this->handle));

        if ($data !== '') {
            $this->data = unserialize($data);
            $data = null;
        }

        flock($this->handle, LOCK_UN);

        $this->iterator = new \ArrayIterator($this->data);
    }
650925
private function read()
    {
        flock($this->file, LOCK_SH);
        rewind($this->file);
        $content = fgets($this->file);
        flock($this->file, LOCK_UN);

        $this->records = unserialize($content);
    }
459967
protected function readLine()
    {
        $buffer = '';

        while ($buffer === '') {
            $buffer = fgets($this->getFileHandler());

            if ($buffer === false) {
                $this->currentLine = null;

                return;
            }

            $buffer = trim($buffer);
        }

        if ($buffer === ']') {
            $this->currentLine = null;

            return;
        }

        $data = json_decode(rtrim($buffer, ','), true);
        $this->currentLine = $this->getOptionsResolver()->resolve($data);
    }
986327
protected function readLine()
    {
        $buffer = '';

        while ($buffer === '') {
            if (($buffer = fgets($this->getFileHandler())) === false) {
                $this->currentLine = null;

                return;
            }
            $buffer = trim($buffer, "\n\r\0");

            if (!$this->skipEmptyLines) {
                break;
            }
        }

        $this->currentLine = $buffer;
    }
8538
public function parseEncodedString()
    {
        $l = $this->parseEncodedBinary();
        if (($l === null) || ($l === false)) {
            return $l;
        }
        return $this->read($l);
    }
193705
public void readLangs() {
        final ServletContext servletContext = AbstractServletListener.getServletContext();

        @SuppressWarnings("unchecked") final Set<String> resourcePaths = servletContext.getResourcePaths("/plugins/" + dirName);

        for (final String resourcePath : resourcePaths) {
            if (resourcePath.contains("lang_") && resourcePath.endsWith(".properties")) {
                final String langFileName = StringUtils.substringAfter(resourcePath, "/plugins/" + dirName + "/");

                final String key = langFileName.substring("lang_".length(), langFileName.lastIndexOf("."));
                final Properties props = new Properties();

                try {
                    final File file = Latkes.getWebFile(resourcePath);

                    props.load(new FileInputStream(file));

                    langs.put(key, props);
                } catch (final Exception e) {
                    Logger.getLogger(getClass().getName()).log(Level.ERROR, "Get plugin[name=" + name + "]'s language configuration failed",
                            e);
                }
            }
        }
    }
1222096
protected function loadStrings(string $language, string $file): void
	{
		if($this->cache !== null)
		{
			if($this->loadFromCache($language, $file))
			{
				return;
			}

			$this->rebuildCache = true;
		}

		$this->strings[$language][$file] = $this->loader->loadStrings($language, $file);
	}
537639
def get_file_language(filename, text=None):
    """"""
    ext = osp.splitext(filename)[1]
    if ext.startswith('.'):
        ext = ext[1:] # file extension with leading dot
    language = ext
    if not ext:
        if text is None:
            text, _enc = encoding.read(filename)
        for line in text.splitlines():
            if not line.strip():
                continue
            if line.startswith('#!'):
               shebang = line[2:]
               if 'python' in shebang:
                   language = 'python'
            else:
                break
    return language
600412
protected function readLine()
    {
        if ($this->line_number === 0)
        {
            $st = ftell($this->file_handle);
            if ($st === 0)
            { 
                // Attempt to read a Byte Order Mark only if this file handle is at the start of the file
                $utf8_bom = Encoding::getBOM('UTF8');
                $maybe_bom = fread($this->file_handle, 3);
                $this->has_bom = $utf8_bom === $maybe_bom;

                // Rewind if the first three characters are not the UTF8 BOM
                if (!$this->has_bom)
                    fseek($this->file_handle, 0);
            }
        }

        if ($this->read_header && empty($this->line_number) && $this->header === null)
            $this->header = fgetcsv($this->file_handle, 0, $this->delimiter, $this->enclosure, $this->escape_char);

        $line = fgetcsv($this->file_handle, 0, $this->delimiter, $this->enclosure, $this->escape_char);

        if ($line === false)
        {
            $this->current_line = false;
            return;
        }

        if ($this->header !== null)
        {
            $row = array();
            foreach ($line as $idx => $col)
            {
                $name = isset($this->header[$idx]) ? $this->header[$idx] : null;
                if ($name)
                    $row[$name] = $col;
                else
                    $row[] = $col;
            }
            $this->current_line = $row;
        }
        else
            $this->current_line = $line;
    }
249298
public function parseTranslationFile() {
        $base_path = $this->getMinkParameter('files_path');
        $base_path = $base_path."/";
        $file_path = $base_path.$this->multilingual_parameters['translations'];
        $yaml = file_get_contents($file_path);
        $yaml_parse_array_check = Yaml::parse($yaml);
        if(is_array($yaml_parse_array_check)) {
            $this->translations = $yaml_parse_array_check;
        }
    }
39156
function (/*String*/path, /*String?*/encoding) {
        if (encoding === 'utf-8') {
            encoding = 'utf8';
        }
        if (!encoding) {
            encoding = 'utf8';
        }

        return fs.readFileSync(path, encoding);
    }
799455
protected function read()
	{
		if( !file_exists( $this->fileName ) )
			throw new RuntimeException( 'File "'.$this->fileName.'" is not existing.' );
		$this->data		= parse_ini_file( $this->fileName, true );
	}
1021796
public function write()
    {
        
        $tf = $this->getTranslationFile();
        $buffer = "<?php\n";
        foreach ($tf->getTranslationUnits() as $tu){
            // Prevent empty messages.
            if ($tu->getSource() != '' && $tu->getTarget() != ''){
                $escapes = array("\\", '$', '"', "\n", "\t", "\v", "\r", "\f");
                $replace = array("\\\\", '\\$', '\\"', "\\n", "\\t", "\\v", "\\r", "\\f");
                $source = str_replace($escapes, $replace, $tu->getSource());
                $target = str_replace($escapes, $replace, $tu->getTarget());
                $buffer .= '$GLOBALS[\'__l10n\']["' . $source . '"]="' . $target . '";' . "\n";
            }
        }
        $buffer .= "\n?>";
        
        file_put_contents($this->getFilePath(), $buffer);
        
    }
716254
public function read()
    {
        $result = '';
        $ht = $this->getHTaccessFilename();
        $fs = $this->getFilesystem();
        if (@$fs->isFile($ht)) {
            $result = @$fs->get($ht);
            if ($result === false) {
                throw new Exception("Failed to read from file $ht");
            }
        }

        return $result;
    }
750716
protected function read()
    {
        $buffer = '';
        while (($line = fgets($this->_connection, 1000)) != null) { // intentionally ==
            $buffer .= $line;
            if (substr($line, 3, 1) === ' ') {
                break;
            }
        }
        return $buffer;
    }