symfony/translation · error · InvalidArgumentException

No support implemented for dumping XLIFF version

Error message

No support implemented for dumping XLIFF version "%s".

What it means

Version guard in XliffFileDumper::formatCatalogue(): the 'xliff_version' option passed to format()/dump() is neither '1.2' nor '2.0' (the only versions with dump implementations), so the dumper cannot serialize the message catalogue and throws with the unsupported version substituted into the message.

Solutions

  1. Pass the option explicitly: $dumper->format($catalogue, 'messages', ['xliff_version' => '1.2']) or '2.0'.
  2. Omit 'xliff_version' to use the default version 1.2.
  3. If the file must be XLIFF 2.1/2.x, dump as 2.0 or post-process the output; no other versions are supported.

Example fix

// before
$dumper->dump($catalogue, ['path' => $dir, 'xliff_version' => '2.1']);
// after
$dumper->dump($catalogue, ['path' => $dir, 'xliff_version' => '2.0']);
Defensive patterns

Strategy: validation

Validate before calling

$v = $options['xliff_version'] ?? '1.2'; if (!in_array($v, ['1.2','2.0'], true)) { throw new \InvalidArgumentException("Unsupported XLIFF version {$v}; use 1.2 or 2.0"); }

Type guard

function isSupportedXliffVersion(string $v): bool { return in_array($v, ['1.2','2.0'], true); }

Try / catch

try { $dumper->dump($catalogue, $options); } catch (InvalidArgumentException $e) { if (str_contains($e->getMessage(), 'XLIFF version')) { // fall back to default version } }

Prevention

When it happens

Trigger: Calling dump()/formatCatalogue() with options ['xliff_version' => 'something-other-than-1.2-or-2.0'], e.g. '2.1', '1.0', or a typo.

Common situations: Wanting to dump XLIFF 2.1 (unsupported by this dumper); typo'd version string in config; copying options from another tool.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of symfony/translation@ae9e8a51bc (2026-09-15). Data as JSON: /api/errors/73b1db53e5c4cfd5. Report an issue: GitHub.

Appendix: source

Thrown at Dumper/XliffFileDumper.php:49

        $xliffVersion = '1.2';
        if (\array_key_exists('xliff_version', $options)) {
            $xliffVersion = $options['xliff_version'];
        }

        if (\array_key_exists('default_locale', $options)) {
            $defaultLocale = $options['default_locale'];
        } else {
            $defaultLocale = \Locale::getDefault();
        }

        if ('1.2' === $xliffVersion) {
            return $this->dumpXliff1($defaultLocale, $messages, $domain, $options);
        }
        if ('2.0' === $xliffVersion) {
            return $this->dumpXliff2($defaultLocale, $messages, $domain);
        }

        throw new InvalidArgumentException(\sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
    }

    protected function getExtension(): string
    {
        return $this->extension;
    }

    private function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, ?string $domain, array $options = []): string
    {
        $toolInfo = ['tool-id' => 'symfony', 'tool-name' => 'Symfony'];
        if (\array_key_exists('tool_info', $options)) {
            $toolInfo = array_merge($toolInfo, $options['tool_info']);
        }

        $dom = new \DOMDocument('1.0', 'utf-8');
        $dom->formatOutput = true;

        $xliff = $dom->appendChild($dom->createElement('xliff'));

View on GitHub (pinned to ae9e8a51bc)