public function formatForExport($trans, $options = null)
    {
        $text = "<?php\n\nreturn " . (($options & self::OPT_USE_SHORT_ARRAY) ? "[\n" : "array(\n");

        // create sections to match the comments
        $iMax = count($this->sections);
        $sections = array_fill(0, $iMax + 1, []);

        // assemble keys by sections
        foreach ($trans as $key => $value) {
            if (array_key_exists($key, $this->firstLevelKeys)) {
                $sections[$this->firstLevelKeys[$key]['section'] + 1][$key] = $value;
            } else {
                $sections[$iMax ? 1 : 0][$key] = $value;
            }
        }

        if ($options & self::OPT_PRESERVE_EMPTY_ARRAYS) {
            foreach ($this->firstLevelKeys as $key => $keyData) {
                if (!array_key_exists($key, $trans) && ($keyData['data_format'] === '[' || $keyData['data_format'] === 'array(')) {
                    // add it to its section
                    $sections[$keyData['section'] + 1][$key] = [];
                }
            }
        }

        for ($i = 0; $i < $iMax + 1; $i++) {
            if ($i) {
                $text .= $this->sections[$i - 1];
            }

            if ($sections[$i]) $text .= $this->formatSection($sections[$i], $options);
        }

        $text .= (($options & self::OPT_USE_SHORT_ARRAY) ? "]" : ")") . ";\n";
        return $text;
    }
public function formatForExport($trans, $options = null)
    {
        $text = "<?php\n\nreturn " . (($options & self::OPT_USE_SHORT_ARRAY) ? "[\n" : "array(\n");

        // create sections to match the comments
        $iMax = count($this->sections);
        $sections = array_fill(0, $iMax + 1, []);

        // assemble keys by sections
        foreach ($trans as $key => $value) {
            if (array_key_exists($key, $this->firstLevelKeys)) {
                $sections[$this->firstLevelKeys[$key]['section'] + 1][$key] = $value;
            } else {
                $sections[$iMax ? 1 : 0][$key] = $value;
            }
        }

        if ($options & self::OPT_PRESERVE_EMPTY_ARRAYS) {
            foreach ($this->firstLevelKeys as $key => $keyData) {
                if (!array_key_exists($key, $trans) && ($keyData['data_format'] === '[' || $keyData['data_format'] === 'array(')) {
                    // add it to its section
                    $sections[$keyData['section'] + 1][$key] = [];
                }
            }
        }

        for ($i = 0; $i < $iMax + 1; $i++) {
            if ($i) {
                $text .= $this->sections[$i - 1];
            }

            if ($sections[$i]) $text .= $this->formatSection($sections[$i], $options);
        }

        $text .= (($options & self::OPT_USE_SHORT_ARRAY) ? "]" : ")") . ";\n";
        return $text;
    }
@param      array $trans translation to output
@param null|integer $options formatting options

@return string result of output of translations taking sections into account