diff --git a/webapp/src/Service/ImportExportService.php b/webapp/src/Service/ImportExportService.php index 2b2dcc217b..cedde37bf6 100644 --- a/webapp/src/Service/ImportExportService.php +++ b/webapp/src/Service/ImportExportService.php @@ -395,7 +395,7 @@ public function importContestData(mixed $data, ?string &$errorMessage = null, ?s /** * @param array{name?: string, short-name?: string, id?: string, label?: string, * letter?: string, time_limit?: int, rgb?: string, color?: string, - * problems?: array{name?: string, short-name?: string, id?: string, label?: string, + * problems?: array{name?: string|array, short-name?: string, id?: string, label?: string, * letter?: string, label?: string, letter?: string}} $problems * @param string[]|null $ids * @param array $messages @@ -413,6 +413,16 @@ public function importProblemsData(Contest $contest, array $problems, ?array &$i $problemName = $problemData['name'] ?? $problemData['short-name'] ?? $problemData['id'] ?? null; $problemLabel = $problemData['label'] ?? $problemData['letter'] ?? null; + // The 2025-09 problem spec allows a 'language code'->'name' map. + if (is_array($problemName)) { + if (array_key_exists('en', $problemName)) { + $problemName = $problemName['en']; + } else { + $errorMessage = sprintf("Problem '%s' should have an English name", $problemName['id']); + return false; + } + } + $problem = new Problem(); $problem ->setName($problemName)