Skip to content

Commit a2157f9

Browse files
committed
Ignore "menu" attributes in locale display names
1 parent a5dc1b2 commit a2157f9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

bin/import-cldr-data

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,18 @@ abstract class LocaleDisplayName extends Processor
497497
$data = array();
498498
$xpath = new DOMXPath($doc);
499499
$xElementList = $xpath->query($this->getXPathSelector());
500+
$expectedKeys = array();
500501
foreach ($xElementList as $xElement) {
501502
$type = (string) $xElement->getAttribute('type');
502503
if ($type === '') {
503504
throw new RuntimeException('Missing type attribute');
504505
}
505506
$key = str_replace('_', '-', $type);
507+
$menu = (string) $xElement->getAttribute('menu');
508+
if ($menu !== '') {
509+
$expectedKeys[] = $key;
510+
continue;
511+
}
506512
$alt = (string) $xElement->getAttribute('alt');
507513
if ($alt !== '') {
508514
$key = "{$key}-alt-{$alt}";
@@ -512,6 +518,11 @@ abstract class LocaleDisplayName extends Processor
512518
}
513519
$data[$key] = (string) $xElement->textContent;
514520
}
521+
foreach (array_unique($expectedKeys) as $expectedKey) {
522+
if (!isset($data[$expectedKey])) {
523+
throw new RuntimeException("Missing expected key {$expectedKey}");
524+
}
525+
}
515526
if ($data === array()) {
516527
throw new RuntimeException('No elements found');
517528
}

0 commit comments

Comments
 (0)