Skip to content

Instantly share code, notes, and snippets.

@Vitexus
Last active June 12, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vitexus/1aa5f32d7a2ea6d2455bc644e478a4ba to your computer and use it in GitHub Desktop.
Save Vitexus/1aa5f32d7a2ea6d2455bc644e478a4ba to your computer and use it in GitHub Desktop.
Generator of FlexiBee EN,DE,FR Country names https://gist.github.com/Vitexus/0d02d88808b00a3516fe97856e8154a2
<?php
/**
* @author Vítězslav Dvořák <info@vitexsoftware.cz>
*
* Thanks to https://github.com/mledoze/countries
*/
require_once '../vendor/autoload.php';
$coder = new \FlexiPeeHP\FlexiBeeRW(null, ['evidence' => 'stat','offline'=>'true']);
$newCodes = json_decode(file_get_contents('countries.json'), 'true');
foreach ($newCodes as $country) {
$item = new \FlexiPeeHP\FlexiBeeRW([
'id' => FlexiPeeHP\FlexiBeeRO::code($country['cca2']),
'nazev' => $country['translations']['ces']['official'],
'nazevA' => $country['name']['official'],
'nazevB' => $country['translations']['deu']['official'],
'nazevC' => $country['translations']['fra']['official'],
'@create' => 'ignore'
], ['evidence' => 'stat', 'offline' => 'true']);
$coder->join($item);
}
$change = $coder->getJsonizedData(null, JSON_PRETTY_PRINT);
echo $change;
file_put_contents('../doplneni-statu.json', $change);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment