Remove unknown language codes from territories
Since they are not used, they only waste space.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -69,6 +69,26 @@ foreach ( $supplementalData->territoryInfo->territory as $territoryRecord ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ( $parsedLangdb['territories'] as $territoryCode => $languages ) {
|
||||||
|
foreach ( $languages as $index => $language ) {
|
||||||
|
if ( !isset( $parsedLangdb['languages'][$language] ) ) {
|
||||||
|
echo "Unknown language $language for territory $territoryCode\n";
|
||||||
|
unset( $parsedLangdb['territories'][$territoryCode][$index] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean-up to save space
|
||||||
|
if ( count( $parsedLangdb['territories'][$territoryCode] ) === 0 ) {
|
||||||
|
unset( $parsedLangdb['territories'][$territoryCode] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to renumber or json conversion thinks these are objects
|
||||||
|
$parsedLangdb['territories'][$territoryCode] =
|
||||||
|
array_values( $parsedLangdb['territories'][$territoryCode] );
|
||||||
|
}
|
||||||
|
|
||||||
print "Writing JSON langdb...\n";
|
print "Writing JSON langdb...\n";
|
||||||
$jsonVerbose = json_encode( $parsedLangdb, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
|
$jsonVerbose = json_encode( $parsedLangdb, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
|
||||||
$jsonSlim = json_encode( $parsedLangdb, JSON_UNESCAPED_UNICODE );
|
$jsonSlim = json_encode( $parsedLangdb, JSON_UNESCAPED_UNICODE );
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user