src/Circlical/PoEditor/Block.php
public function compile()
	{
		// can happen if it parses only comments/artifacts
		if (!count($this->msgid))
			return "";

		$str = "";
		if ($this->comments)
			$str .= implode(self::NEWLINE, $this->comments) . self::NEWLINE;

		if ($this->msgctxt)
			$str .= 'msgctxt "' . $this->msgctxt . '"' . self::NEWLINE;

		$included_blocks = ['msgid'];
		if ($this->msgstr_plural)
			$included_blocks[] = 'msgid_plural';
		else
			$included_blocks[] = 'msgstr';

		foreach ($included_blocks as $key) {
			if (is_array($this->$key)) {
				$str .= "$key ";
				$str .= implode(self::NEWLINE, array_map([$this, 'quoteWrap'], $this->$key)) . self::NEWLINE;
			}
		}

		if ($this->msgid_plural && $this->msgstr_plural) {
			foreach ($this->msgstr_plural as $plural_key => $plural_message) {
				$str .= 'msgstr[' . $plural_key . '] ';
				$str .= implode(self::NEWLINE, array_map([$this, 'quoteWrap'], $plural_message)) . self::NEWLINE;
			}
		}

		return trim($str);
	}
public function compile()
	{
		// can happen if it parses only comments/artifacts
		if (!count($this->msgid))
			return "";

		$str = "";
		if ($this->comments)
			$str .= implode(self::NEWLINE, $this->comments) . self::NEWLINE;

		if ($this->msgctxt)
			$str .= 'msgctxt "' . $this->msgctxt . '"' . self::NEWLINE;

		$included_blocks = ['msgid'];
		if ($this->msgstr_plural)
			$included_blocks[] = 'msgid_plural';
		else
			$included_blocks[] = 'msgstr';

		foreach ($included_blocks as $key) {
			if (is_array($this->$key)) {
				$str .= "$key ";
				$str .= implode(self::NEWLINE, array_map([$this, 'quoteWrap'], $this->$key)) . self::NEWLINE;
			}
		}

		if ($this->msgid_plural && $this->msgstr_plural) {
			foreach ($this->msgstr_plural as $plural_key => $plural_message) {
				$str .= 'msgstr[' . $plural_key . '] ';
				$str .= implode(self::NEWLINE, array_map([$this, 'quoteWrap'], $plural_message)) . self::NEWLINE;
			}
		}

		return trim($str);
	}
Take all the parsed block parts and flatten them into a gettext-ready string; the part in the PO file
that this block represents.

@return string