Use MD_STD::json_encode over general \json_encode()
This commit is contained in:
parent
d9a0985feb
commit
b4c941f441
|
@ -53,11 +53,9 @@ function getNames(array $data):array {
|
||||||
// Q6256 => country
|
// Q6256 => country
|
||||||
|
|
||||||
$targets = [
|
$targets = [
|
||||||
/*
|
|
||||||
'Q6256' => 'countries',
|
'Q6256' => 'countries',
|
||||||
'Q3024240' => 'historical_countries',
|
'Q3024240' => 'historical_countries',
|
||||||
'Q10864048' => 'first_lvl_administrative_units',
|
'Q10864048' => 'first_lvl_administrative_units',
|
||||||
*/
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$langs = ['ar', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'ha', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'ka', 'ko', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'sw', 'ta', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'zh'];
|
$langs = ['ar', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'ha', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'ka', 'ko', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'sw', 'ta', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'zh'];
|
||||||
|
@ -66,7 +64,7 @@ foreach ($langs as $lang) {
|
||||||
foreach ($targets as $qid => $filename) {
|
foreach ($targets as $qid => $filename) {
|
||||||
|
|
||||||
$regionNames = getNames(query($lang, $qid));
|
$regionNames = getNames(query($lang, $qid));
|
||||||
file_put_contents(__DIR__ . '/../static/' . $filename . '.' . $lang . '.json', json_encode($regionNames));
|
file_put_contents(__DIR__ . '/../static/' . $filename . '.' . $lang . '.json', MD_STD::json_encode($regionNames));
|
||||||
echo "Fetched $lang : $filename ($qid)" . PHP_EOL;
|
echo "Fetched $lang : $filename ($qid)" . PHP_EOL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,6 +94,6 @@ $mergedValues['cardinal_directions'][] = 'Süd';
|
||||||
|
|
||||||
foreach ($mergedValues as $filename => $values) {
|
foreach ($mergedValues as $filename => $values) {
|
||||||
|
|
||||||
file_put_contents(__DIR__ . '/../static/' . $filename . '.json', json_encode(array_values(array_unique($values))));
|
file_put_contents(__DIR__ . '/../static/' . $filename . '.json', MD_STD::json_encode(array_values(array_unique($values))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user