Skip to content

Commit

Permalink
Remove Swiss administrative areas, they aren't used for addressing.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojanz committed Oct 8, 2015
1 parent d396ffa commit 04fbe8a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 320 deletions.
10 changes: 10 additions & 0 deletions resources/library_customizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ function get_subdivision_customizations($parentId) {
'postal_code_pattern' => '24[46-9]|254|26[23]',
],
];
// Remove Swiss administrative areas, they're not used for addressing.
// https://github.com/googlei18n/libaddressinput/issues/89
$subdivisionCustomizations['CH'] = [
'_remove' => [
'CH-AG', 'CH-AR', 'CH-AI', 'CH-BE', 'CH-BL', 'CH-BS', 'CH-FR',
'CH-GE', 'CH-GL', 'CH-GR', 'CH-JU', 'CH-LU', 'CH-NE', 'CH-NW',
'CH-OW', 'CH-SH', 'CH-SZ', 'CH-SO', 'CH-SG', 'CH-TI', 'CH-TG',
'CH-UR', 'CH-VD', 'CH-VS', 'CH-ZG', 'CH-ZH',
],
];

return isset($subdivisionCustomizations[$parentId]) ? $subdivisionCustomizations[$parentId] : [];
}
319 changes: 0 additions & 319 deletions resources/subdivision/CH.json

This file was deleted.

1 change: 0 additions & 1 deletion resources/subdivision/depths.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"ES": 1,
"KN": 1,
"SR": 1,
"CH": 1,
"TW": 2,
"TH": 1,
"TR": 1,
Expand Down
4 changes: 4 additions & 0 deletions scripts/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ function generate_subdivisions($countryCode, $parentId, $subdivisionPaths, $lang
// Apply any found customizations.
$customizations = get_subdivision_customizations($parentId);
$subdivisions[$parentId] = apply_subdivision_customizations($subdivisions[$parentId], $customizations);
// All subdivisions have been removed. Remove the rest of the data.
if (empty($subdivisions[$parentId]['subdivisions'])) {
unset($subdivisions[$parentId]);
}

return $subdivisions;
}
Expand Down

0 comments on commit 04fbe8a

Please sign in to comment.