src/Entity/Localisation/CountryInfo.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Localisation;
  3. use App\Entity\User;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass="App\Repository\Localisation\CountryInfoRepository")
  9. * @ORM\Table(name="country_info", indexes={
  10. * @ORM\Index(name="idx_country_iso", columns={"iso_code"}),
  11. * @ORM\Index(name="idx_geoname_id", columns={"geoname_id"}),
  12. * @ORM\Index(name="idx_currency_code", columns={"currency_code"})
  13. * })
  14. */
  15. class CountryInfo
  16. {
  17. /**
  18. * @ORM\Id
  19. * @ORM\GeneratedValue
  20. * @ORM\Column(type="integer")
  21. */
  22. private $id;
  23. /**
  24. * @ORM\Column(type="string", length=2, unique=true)
  25. */
  26. private $isoCode;
  27. /**
  28. * @ORM\Column(type="string", length=3)
  29. */
  30. private $iso3Code;
  31. /**
  32. * @ORM\Column(type="string", length=100)
  33. */
  34. private $countryName;
  35. /**
  36. * @ORM\Column(type="string", length=100, nullable=true)
  37. */
  38. private $capital;
  39. /**
  40. * @ORM\Column(type="string", length=3, nullable=true)
  41. */
  42. private $currencyCode;
  43. /**
  44. * @ORM\Column(type="string", length=100, nullable=true)
  45. */
  46. private $currencyName;
  47. /**
  48. * @ORM\Column(type="text", nullable=true)
  49. */
  50. private $languages;
  51. /**
  52. * @ORM\Column(type="string", length=2, nullable=true)
  53. */
  54. private $continent;
  55. /**
  56. * @ORM\Column(type="integer", nullable=true)
  57. */
  58. private $population;
  59. /**
  60. * @ORM\Column(type="float", nullable=true)
  61. */
  62. private $area;
  63. /**
  64. * @ORM\Column(type="string", length=10, nullable=true)
  65. */
  66. private $tld;
  67. /**
  68. * @ORM\Column(type="string", length=20, nullable=true)
  69. */
  70. private $phoneCode;
  71. /**
  72. * @ORM\Column(type="integer", unique=true)
  73. */
  74. private $geonameId;
  75. /**
  76. * @ORM\Column(type="string", length=500, nullable=true)
  77. */
  78. private $neighbours;
  79. /**
  80. * @ORM\Column(type="datetime", nullable=true)
  81. */
  82. private $lastUpdated;
  83. /**
  84. * @ORM\OneToMany(targetEntity=User::class, mappedBy="country")
  85. */
  86. private $users;
  87. /**
  88. * @ORM\Column(type="string", length=255, nullable=true)
  89. */
  90. private $countryNameFr;
  91. public function __construct()
  92. {
  93. $this->lastUpdated = new \DateTime();
  94. $this->users = new ArrayCollection();
  95. }
  96. public function getId(): ?int
  97. {
  98. return $this->id;
  99. }
  100. public function getIsoCode(): ?string
  101. {
  102. return $this->isoCode;
  103. }
  104. public function setIsoCode(string $isoCode): self
  105. {
  106. $this->isoCode = $isoCode;
  107. return $this;
  108. }
  109. public function getIso3Code(): ?string
  110. {
  111. return $this->iso3Code;
  112. }
  113. public function setIso3Code(string $iso3Code): self
  114. {
  115. $this->iso3Code = $iso3Code;
  116. return $this;
  117. }
  118. public function getCountryName(): ?string
  119. {
  120. return $this->countryName;
  121. }
  122. public function setCountryName(string $countryName): self
  123. {
  124. $this->countryName = $countryName;
  125. return $this;
  126. }
  127. public function getCapital(): ?string
  128. {
  129. return $this->capital;
  130. }
  131. public function setCapital(?string $capital): self
  132. {
  133. $this->capital = $capital;
  134. return $this;
  135. }
  136. public function getCurrencyCode(): ?string
  137. {
  138. return $this->currencyCode;
  139. }
  140. public function setCurrencyCode(?string $currencyCode): self
  141. {
  142. $this->currencyCode = $currencyCode;
  143. return $this;
  144. }
  145. public function getCurrencyName(): ?string
  146. {
  147. return $this->currencyName;
  148. }
  149. public function setCurrencyName(?string $currencyName): self
  150. {
  151. $this->currencyName = $currencyName;
  152. return $this;
  153. }
  154. public function getLanguages(): ?string
  155. {
  156. return $this->languages;
  157. }
  158. public function setLanguages(?string $languages): self
  159. {
  160. $this->languages = $languages;
  161. return $this;
  162. }
  163. /**
  164. * Retourne un tableau des langues parlées
  165. */
  166. public function getLanguagesArray(): array
  167. {
  168. if (!$this->languages) {
  169. return [];
  170. }
  171. return array_map('trim', explode(',', $this->languages));
  172. }
  173. /**
  174. * Retourne la langue principale (première dans la liste)
  175. */
  176. public function getPrimaryLanguage(): ?string
  177. {
  178. $languages = $this->getLanguagesArray();
  179. if (empty($languages)) {
  180. return null;
  181. }
  182. // Extrait le code de langue (avant le tiret s'il y en a un)
  183. $firstLang = $languages[0];
  184. if (strpos($firstLang, '-') !== false) {
  185. return substr($firstLang, 0, strpos($firstLang, '-'));
  186. }
  187. return $firstLang;
  188. }
  189. public function getContinent(): ?string
  190. {
  191. return $this->continent;
  192. }
  193. public function setContinent(?string $continent): self
  194. {
  195. $this->continent = $continent;
  196. return $this;
  197. }
  198. public function getPopulation(): ?int
  199. {
  200. return $this->population;
  201. }
  202. public function setPopulation(?int $population): self
  203. {
  204. $this->population = $population;
  205. return $this;
  206. }
  207. public function getArea(): ?float
  208. {
  209. return $this->area;
  210. }
  211. public function setArea(?float $area): self
  212. {
  213. $this->area = $area;
  214. return $this;
  215. }
  216. public function getTld(): ?string
  217. {
  218. return $this->tld;
  219. }
  220. public function setTld(?string $tld): self
  221. {
  222. $this->tld = $tld;
  223. return $this;
  224. }
  225. public function getPhoneCode(): ?string
  226. {
  227. return $this->phoneCode;
  228. }
  229. public function setPhoneCode(?string $phoneCode): self
  230. {
  231. $this->phoneCode = $phoneCode;
  232. return $this;
  233. }
  234. public function getGeonameId(): ?int
  235. {
  236. return $this->geonameId;
  237. }
  238. public function setGeonameId(int $geonameId): self
  239. {
  240. $this->geonameId = $geonameId;
  241. return $this;
  242. }
  243. public function getNeighbours(): ?string
  244. {
  245. return $this->neighbours;
  246. }
  247. public function setNeighbours(?string $neighbours): self
  248. {
  249. $this->neighbours = $neighbours;
  250. return $this;
  251. }
  252. /**
  253. * Retourne un tableau des pays voisins
  254. */
  255. public function getNeighboursArray(): array
  256. {
  257. if (!$this->neighbours) {
  258. return [];
  259. }
  260. return array_map('trim', explode(',', $this->neighbours));
  261. }
  262. public function getLastUpdated(): ?\DateTimeInterface
  263. {
  264. return $this->lastUpdated;
  265. }
  266. public function setLastUpdated(?\DateTimeInterface $lastUpdated): self
  267. {
  268. $this->lastUpdated = $lastUpdated;
  269. return $this;
  270. }
  271. /**
  272. * Met à jour le timestamp de dernière modification
  273. */
  274. public function updateTimestamp(): self
  275. {
  276. $this->lastUpdated = new \DateTime();
  277. return $this;
  278. }
  279. /**
  280. * @return Collection<int, User>
  281. */
  282. public function getUsers(): Collection
  283. {
  284. return $this->users;
  285. }
  286. public function addUser(User $user): self
  287. {
  288. if (!$this->users->contains($user)) {
  289. $this->users[] = $user;
  290. $user->setCountry($this);
  291. }
  292. return $this;
  293. }
  294. public function removeUser(User $user): self
  295. {
  296. if ($this->users->removeElement($user)) {
  297. // set the owning side to null (unless already changed)
  298. if ($user->getCountry() === $this) {
  299. $user->setCountry(null);
  300. }
  301. }
  302. return $this;
  303. }
  304. public function getCountryNameFr(): ?string
  305. {
  306. return $this->countryNameFr;
  307. }
  308. public function setCountryNameFr(?string $countryNameFr): self
  309. {
  310. $this->countryNameFr = $countryNameFr;
  311. return $this;
  312. }
  313. /**
  314. * Met à jour le nom français du pays à partir du nom anglais
  315. * Utilise l'extension Intl de PHP pour obtenir la traduction française
  316. */
  317. public function updateCountryNameFr(): self
  318. {
  319. if (!$this->countryName) {
  320. return $this;
  321. }
  322. // Mapping basé sur les noms anglais exacts (plus fiable)
  323. $countryNameMapping = [
  324. 'Andorra' => 'Andorre',
  325. 'United Arab Emirates' => 'Émirats arabes unis',
  326. 'Afghanistan' => 'Afghanistan',
  327. 'Antigua and Barbuda' => 'Antigua-et-Barbuda',
  328. 'Anguilla' => 'Anguilla',
  329. 'Albania' => 'Albanie',
  330. 'Armenia' => 'Arménie',
  331. 'Angola' => 'Angola',
  332. 'Antarctica' => 'Antarctique',
  333. 'Argentina' => 'Argentine',
  334. 'American Samoa' => 'Samoa américaines',
  335. 'Austria' => 'Autriche',
  336. 'Australia' => 'Australie',
  337. 'Aruba' => 'Aruba',
  338. 'Aland Islands' => 'Îles Åland',
  339. 'Azerbaijan' => 'Azerbaïdjan',
  340. 'Bosnia and Herzegovina' => 'Bosnie-Herzégovine',
  341. 'Barbados' => 'Barbade',
  342. 'Bangladesh' => 'Bangladesh',
  343. 'Belgium' => 'Belgique',
  344. 'Burkina Faso' => 'Burkina Faso',
  345. 'Bulgaria' => 'Bulgarie',
  346. 'Bahrain' => 'Bahreïn',
  347. 'Burundi' => 'Burundi',
  348. 'Benin' => 'Bénin',
  349. 'Saint Barthelemy' => 'Saint-Barthélemy',
  350. 'Bermuda' => 'Bermudes',
  351. 'Brunei' => 'Brunei',
  352. 'Bolivia' => 'Bolivie',
  353. 'Bonaire, Saint Eustatius and Saba ' => 'Bonaire, Saint-Eustache et Saba',
  354. 'Brazil' => 'Brésil',
  355. 'Bahamas' => 'Bahamas',
  356. 'Bhutan' => 'Bhoutan',
  357. 'Bouvet Island' => 'Île Bouvet',
  358. 'Botswana' => 'Botswana',
  359. 'Belarus' => 'Biélorussie',
  360. 'Belize' => 'Belize',
  361. 'Canada' => 'Canada',
  362. 'Cocos Islands' => 'Îles Cocos',
  363. 'Democratic Republic of the Congo' => 'République démocratique du Congo',
  364. 'Central African Republic' => 'République centrafricaine',
  365. 'Republic of the Congo' => 'République du Congo',
  366. 'Switzerland' => 'Suisse',
  367. 'Ivory Coast' => 'Côte d\'Ivoire',
  368. 'Cook Islands' => 'Îles Cook',
  369. 'Chile' => 'Chili',
  370. 'Cameroon' => 'Cameroun',
  371. 'China' => 'Chine',
  372. 'Colombia' => 'Colombie',
  373. 'Costa Rica' => 'Costa Rica',
  374. 'Cuba' => 'Cuba',
  375. 'Cabo Verde' => 'Cap-Vert',
  376. 'Curacao' => 'Curaçao',
  377. 'Christmas Island' => 'Île Christmas',
  378. 'Cyprus' => 'Chypre',
  379. 'Czechia' => 'Tchéquie',
  380. 'Germany' => 'Allemagne',
  381. 'Djibouti' => 'Djibouti',
  382. 'Denmark' => 'Danemark',
  383. 'Dominica' => 'Dominique',
  384. 'Dominican Republic' => 'République dominicaine',
  385. 'Algeria' => 'Algérie',
  386. 'Ecuador' => 'Équateur',
  387. 'Estonia' => 'Estonie',
  388. 'Egypt' => 'Égypte',
  389. 'Western Sahara' => 'Sahara occidental',
  390. 'Eritrea' => 'Érythrée',
  391. 'Spain' => 'Espagne',
  392. 'Ethiopia' => 'Éthiopie',
  393. 'Finland' => 'Finlande',
  394. 'Fiji' => 'Fidji',
  395. 'Falkland Islands' => 'Îles Malouines',
  396. 'Micronesia' => 'Micronésie',
  397. 'Faroe Islands' => 'Îles Féroé',
  398. 'France' => 'France',
  399. 'Gabon' => 'Gabon',
  400. 'United Kingdom' => 'Royaume-Uni',
  401. 'Grenada' => 'Grenade',
  402. 'Georgia' => 'Géorgie',
  403. 'French Guiana' => 'Guyane française',
  404. 'Guernsey' => 'Guernesey',
  405. 'Ghana' => 'Ghana',
  406. 'Gibraltar' => 'Gibraltar',
  407. 'Greenland' => 'Groenland',
  408. 'Gambia' => 'Gambie',
  409. 'Guinea' => 'Guinée',
  410. 'Guadeloupe' => 'Guadeloupe',
  411. 'Equatorial Guinea' => 'Guinée équatoriale',
  412. 'Greece' => 'Grèce',
  413. 'South Georgia and the South Sandwich Islands' => 'Géorgie du Sud-et-les Îles Sandwich du Sud',
  414. 'Guatemala' => 'Guatemala',
  415. 'Guam' => 'Guam',
  416. 'Guinea-Bissau' => 'Guinée-Bissau',
  417. 'Guyana' => 'Guyana',
  418. 'Hong Kong' => 'Hong Kong',
  419. 'Heard Island and McDonald Islands' => 'Îles Heard-et-MacDonald',
  420. 'Honduras' => 'Honduras',
  421. 'Croatia' => 'Croatie',
  422. 'Haiti' => 'Haïti',
  423. 'Hungary' => 'Hongrie',
  424. 'Indonesia' => 'Indonésie',
  425. 'Ireland' => 'Irlande',
  426. 'Israel' => 'Israël',
  427. 'Isle of Man' => 'Île de Man',
  428. 'India' => 'Inde',
  429. 'British Indian Ocean Territory' => 'Territoire britannique de l\'océan Indien',
  430. 'Iraq' => 'Irak',
  431. 'Iran' => 'Iran',
  432. 'Iceland' => 'Islande',
  433. 'Italy' => 'Italie',
  434. 'Jersey' => 'Jersey',
  435. 'Jamaica' => 'Jamaïque',
  436. 'Jordan' => 'Jordanie',
  437. 'Japan' => 'Japon',
  438. 'Kenya' => 'Kenya',
  439. 'Kyrgyzstan' => 'Kirghizistan',
  440. 'Cambodia' => 'Cambodge',
  441. 'Kiribati' => 'Kiribati',
  442. 'Comoros' => 'Comores',
  443. 'Saint Kitts and Nevis' => 'Saint-Kitts-et-Nevis',
  444. 'North Korea' => 'Corée du Nord',
  445. 'South Korea' => 'Corée du Sud',
  446. 'Kosovo' => 'Kosovo',
  447. 'Kuwait' => 'Koweït',
  448. 'Cayman Islands' => 'Îles Caïmans',
  449. 'Kazakhstan' => 'Kazakhstan',
  450. 'Laos' => 'Laos',
  451. 'Lebanon' => 'Liban',
  452. 'Saint Lucia' => 'Sainte-Lucie',
  453. 'Liechtenstein' => 'Liechtenstein',
  454. 'Sri Lanka' => 'Sri Lanka',
  455. 'Liberia' => 'Liberia',
  456. 'Lesotho' => 'Lesotho',
  457. 'Lithuania' => 'Lituanie',
  458. 'Luxembourg' => 'Luxembourg',
  459. 'Latvia' => 'Lettonie',
  460. 'Libya' => 'Libye',
  461. 'Morocco' => 'Maroc',
  462. 'Monaco' => 'Monaco',
  463. 'Moldova' => 'Moldavie',
  464. 'Montenegro' => 'Monténégro',
  465. 'Saint Martin' => 'Saint-Martin',
  466. 'Madagascar' => 'Madagascar',
  467. 'Marshall Islands' => 'Îles Marshall',
  468. 'North Macedonia' => 'Macédoine du Nord',
  469. 'Mali' => 'Mali',
  470. 'Myanmar' => 'Myanmar',
  471. 'Mongolia' => 'Mongolie',
  472. 'Macao' => 'Macao',
  473. 'Northern Mariana Islands' => 'Îles Mariannes du Nord',
  474. 'Martinique' => 'Martinique',
  475. 'Mauritania' => 'Mauritanie',
  476. 'Montserrat' => 'Montserrat',
  477. 'Malta' => 'Malte',
  478. 'Mauritius' => 'Maurice',
  479. 'Maldives' => 'Maldives',
  480. 'Malawi' => 'Malawi',
  481. 'Mexico' => 'Mexique',
  482. 'Malaysia' => 'Malaisie',
  483. 'Mozambique' => 'Mozambique',
  484. 'Namibia' => 'Namibie',
  485. 'New Caledonia' => 'Nouvelle-Calédonie',
  486. 'Niger' => 'Niger',
  487. 'Norfolk Island' => 'Île Norfolk',
  488. 'Nigeria' => 'Nigeria',
  489. 'Nicaragua' => 'Nicaragua',
  490. 'The Netherlands' => 'Pays-Bas',
  491. 'Norway' => 'Norvège',
  492. 'Nepal' => 'Népal',
  493. 'Nauru' => 'Nauru',
  494. 'Niue' => 'Niue',
  495. 'New Zealand' => 'Nouvelle-Zélande',
  496. 'Oman' => 'Oman',
  497. 'Panama' => 'Panama',
  498. 'Peru' => 'Pérou',
  499. 'French Polynesia' => 'Polynésie française',
  500. 'Papua New Guinea' => 'Papouasie-Nouvelle-Guinée',
  501. 'Philippines' => 'Philippines',
  502. 'Pakistan' => 'Pakistan',
  503. 'Poland' => 'Pologne',
  504. 'Saint Pierre and Miquelon' => 'Saint-Pierre-et-Miquelon',
  505. 'Pitcairn' => 'Pitcairn',
  506. 'Puerto Rico' => 'Porto Rico',
  507. 'Palestinian Territory' => 'Palestine',
  508. 'Portugal' => 'Portugal',
  509. 'Palau' => 'Palaos',
  510. 'Paraguay' => 'Paraguay',
  511. 'Qatar' => 'Qatar',
  512. 'Reunion' => 'La Réunion',
  513. 'Romania' => 'Roumanie',
  514. 'Serbia' => 'Serbie',
  515. 'Russia' => 'Russie',
  516. 'Rwanda' => 'Rwanda',
  517. 'Saudi Arabia' => 'Arabie saoudite',
  518. 'Solomon Islands' => 'Îles Salomon',
  519. 'Seychelles' => 'Seychelles',
  520. 'Sudan' => 'Soudan',
  521. 'South Sudan' => 'Soudan du Sud',
  522. 'Sweden' => 'Suède',
  523. 'Singapore' => 'Singapour',
  524. 'Saint Helena' => 'Sainte-Hélène',
  525. 'Slovenia' => 'Slovénie',
  526. 'Svalbard and Jan Mayen' => 'Svalbard et Jan Mayen',
  527. 'Slovakia' => 'Slovaquie',
  528. 'Sierra Leone' => 'Sierra Leone',
  529. 'San Marino' => 'Saint-Marin',
  530. 'Senegal' => 'Sénégal',
  531. 'Somalia' => 'Somalie',
  532. 'Suriname' => 'Suriname',
  533. 'Sao Tome and Principe' => 'São Tomé-et-Príncipe',
  534. 'El Salvador' => 'Salvador',
  535. 'Sint Maarten' => 'Saint-Martin',
  536. 'Syria' => 'Syrie',
  537. 'Eswatini' => 'Eswatini',
  538. 'Turks and Caicos Islands' => 'Îles Turques-et-Caïques',
  539. 'Chad' => 'Tchad',
  540. 'French Southern Territories' => 'Terres australes françaises',
  541. 'Togo' => 'Togo',
  542. 'Thailand' => 'Thaïlande',
  543. 'Tajikistan' => 'Tadjikistan',
  544. 'Tokelau' => 'Tokelau',
  545. 'Timor Leste' => 'Timor oriental',
  546. 'Turkmenistan' => 'Turkménistan',
  547. 'Tunisia' => 'Tunisie',
  548. 'Tonga' => 'Tonga',
  549. 'Turkey' => 'Turquie',
  550. 'Trinidad and Tobago' => 'Trinité-et-Tobago',
  551. 'Tuvalu' => 'Tuvalu',
  552. 'Taiwan' => 'Taïwan',
  553. 'Tanzania' => 'Tanzanie',
  554. 'Ukraine' => 'Ukraine',
  555. 'Uganda' => 'Ouganda',
  556. 'United States Minor Outlying Islands' => 'Îles mineures éloignées des États-Unis',
  557. 'United States' => 'États-Unis',
  558. 'Uruguay' => 'Uruguay',
  559. 'Uzbekistan' => 'Ouzbékistan',
  560. 'Vatican' => 'Vatican',
  561. 'Saint Vincent and the Grenadines' => 'Saint-Vincent-et-les-Grenadines',
  562. 'Venezuela' => 'Venezuela',
  563. 'British Virgin Islands' => 'Îles Vierges britanniques',
  564. 'U.S. Virgin Islands' => 'Îles Vierges américaines',
  565. 'Vietnam' => 'Viêt Nam',
  566. 'Vanuatu' => 'Vanuatu',
  567. 'Wallis and Futuna' => 'Wallis-et-Futuna',
  568. 'Samoa' => 'Samoa',
  569. 'Yemen' => 'Yémen',
  570. 'Mayotte' => 'Mayotte',
  571. 'South Africa' => 'Afrique du Sud',
  572. 'Zambia' => 'Zambie',
  573. 'Zimbabwe' => 'Zimbabwe',
  574. 'Serbia and Montenegro' => 'Serbie-et-Monténégro',
  575. 'Netherlands Antilles' => 'Antilles néerlandaises',
  576. ];
  577. // D'abord, essayer avec le nom exact du pays
  578. if (isset($countryNameMapping[$this->countryName])) {
  579. $this->countryNameFr = $countryNameMapping[$this->countryName];
  580. return $this;
  581. }
  582. // Si le nom exact n'est pas trouvé et qu'on a un code ISO, essayer avec Intl
  583. if ($this->isoCode && extension_loaded('intl') && class_exists('Locale')) {
  584. try {
  585. $frenchName = \Locale::getDisplayRegion('-' . $this->isoCode, 'fr');
  586. if ($frenchName && $frenchName !== $this->isoCode && $frenchName !== '-' . $this->isoCode) {
  587. $this->countryNameFr = $frenchName;
  588. return $this;
  589. }
  590. } catch (\Exception $e) {
  591. // Si Intl échoue, on continue avec le mapping par ISO
  592. }
  593. }
  594. // Fallback: mapping par code ISO pour les pays non couverts
  595. $isoCodeMapping = [
  596. 'US' => 'États-Unis',
  597. 'GB' => 'Royaume-Uni',
  598. 'FR' => 'France',
  599. 'DE' => 'Allemagne',
  600. 'ES' => 'Espagne',
  601. 'IT' => 'Italie',
  602. 'NL' => 'Pays-Bas',
  603. 'BE' => 'Belgique',
  604. 'CH' => 'Suisse',
  605. 'CA' => 'Canada',
  606. 'AU' => 'Australie',
  607. 'NZ' => 'Nouvelle-Zélande',
  608. 'BR' => 'Brésil',
  609. 'MX' => 'Mexique',
  610. 'AR' => 'Argentine',
  611. 'CL' => 'Chili',
  612. 'CO' => 'Colombie',
  613. 'PE' => 'Pérou',
  614. 'VE' => 'Venezuela',
  615. 'PT' => 'Portugal',
  616. 'GR' => 'Grèce',
  617. 'PL' => 'Pologne',
  618. 'CZ' => 'République tchèque',
  619. 'SE' => 'Suède',
  620. 'NO' => 'Norvège',
  621. 'DK' => 'Danemark',
  622. 'FI' => 'Finlande',
  623. 'IE' => 'Irlande',
  624. 'AT' => 'Autriche',
  625. 'RU' => 'Russie',
  626. 'CN' => 'Chine',
  627. 'JP' => 'Japon',
  628. 'KR' => 'Corée du Sud',
  629. 'IN' => 'Inde',
  630. 'SA' => 'Arabie saoudite',
  631. 'AE' => 'Émirats arabes unis',
  632. 'EG' => 'Égypte',
  633. 'ZA' => 'Afrique du Sud',
  634. 'MA' => 'Maroc',
  635. 'DZ' => 'Algérie',
  636. 'TN' => 'Tunisie',
  637. 'SN' => 'Sénégal',
  638. 'CI' => 'Côte d\'Ivoire',
  639. 'CM' => 'Cameroun',
  640. 'CD' => 'République démocratique du Congo',
  641. 'KE' => 'Kenya',
  642. 'NG' => 'Nigeria',
  643. 'GH' => 'Ghana',
  644. 'ET' => 'Éthiopie',
  645. 'TZ' => 'Tanzanie',
  646. 'UG' => 'Ouganda',
  647. 'RW' => 'Rwanda',
  648. 'BF' => 'Burkina Faso',
  649. 'ML' => 'Mali',
  650. 'NE' => 'Niger',
  651. 'TD' => 'Tchad',
  652. 'SD' => 'Soudan',
  653. 'SO' => 'Somalie',
  654. 'DJ' => 'Djibouti',
  655. 'ER' => 'Érythrée',
  656. 'LY' => 'Libye',
  657. 'MR' => 'Mauritanie',
  658. 'GM' => 'Gambie',
  659. 'GW' => 'Guinée-Bissau',
  660. 'GN' => 'Guinée',
  661. 'SL' => 'Sierra Leone',
  662. 'LR' => 'Liberia',
  663. 'TG' => 'Togo',
  664. 'BJ' => 'Bénin',
  665. 'AO' => 'Angola',
  666. 'ZM' => 'Zambie',
  667. 'ZW' => 'Zimbabwe',
  668. 'BW' => 'Botswana',
  669. 'NA' => 'Namibie',
  670. 'LS' => 'Lesotho',
  671. 'SZ' => 'Eswatini',
  672. 'MW' => 'Malawi',
  673. 'MZ' => 'Mozambique',
  674. 'MG' => 'Madagascar',
  675. 'MU' => 'Maurice',
  676. 'SC' => 'Seychelles',
  677. 'KM' => 'Comores',
  678. 'CV' => 'Cap-Vert',
  679. 'ST' => 'São Tomé-et-Príncipe',
  680. 'GQ' => 'Guinée équatoriale',
  681. 'GA' => 'Gabon',
  682. 'CG' => 'Congo',
  683. 'CF' => 'République centrafricaine',
  684. 'TD' => 'Tchad',
  685. 'SS' => 'Soudan du Sud',
  686. 'BI' => 'Burundi',
  687. 'YE' => 'Yémen',
  688. 'OM' => 'Oman',
  689. 'QA' => 'Qatar',
  690. 'BH' => 'Bahreïn',
  691. 'KW' => 'Koweït',
  692. 'IQ' => 'Irak',
  693. 'JO' => 'Jordanie',
  694. 'LB' => 'Liban',
  695. 'SY' => 'Syrie',
  696. 'IL' => 'Israël',
  697. 'PS' => 'Palestine',
  698. 'TR' => 'Turquie',
  699. 'IR' => 'Iran',
  700. 'AF' => 'Afghanistan',
  701. 'PK' => 'Pakistan',
  702. 'BD' => 'Bangladesh',
  703. 'LK' => 'Sri Lanka',
  704. 'MV' => 'Maldives',
  705. 'NP' => 'Népal',
  706. 'BT' => 'Bhoutan',
  707. 'MM' => 'Myanmar',
  708. 'TH' => 'Thaïlande',
  709. 'LA' => 'Laos',
  710. 'KH' => 'Cambodge',
  711. 'VN' => 'Viêt Nam',
  712. 'MY' => 'Malaisie',
  713. 'SG' => 'Singapour',
  714. 'BN' => 'Brunei',
  715. 'PH' => 'Philippines',
  716. 'ID' => 'Indonésie',
  717. 'TL' => 'Timor oriental',
  718. 'PG' => 'Papouasie-Nouvelle-Guinée',
  719. 'FJ' => 'Fidji',
  720. 'NC' => 'Nouvelle-Calédonie',
  721. 'PF' => 'Polynésie française',
  722. 'WS' => 'Samoa',
  723. 'TO' => 'Tonga',
  724. 'VU' => 'Vanuatu',
  725. 'SB' => 'Îles Salomon',
  726. 'KI' => 'Kiribati',
  727. 'TV' => 'Tuvalu',
  728. 'NR' => 'Nauru',
  729. 'PW' => 'Palaos',
  730. 'FM' => 'Micronésie',
  731. 'MH' => 'Îles Marshall',
  732. 'UA' => 'Ukraine',
  733. 'BY' => 'Biélorussie',
  734. 'LT' => 'Lituanie',
  735. 'LV' => 'Lettonie',
  736. 'EE' => 'Estonie',
  737. 'MD' => 'Moldavie',
  738. 'RO' => 'Roumanie',
  739. 'BG' => 'Bulgarie',
  740. 'RS' => 'Serbie',
  741. 'BA' => 'Bosnie-Herzégovine',
  742. 'HR' => 'Croatie',
  743. 'SI' => 'Slovénie',
  744. 'SK' => 'Slovaquie',
  745. 'HU' => 'Hongrie',
  746. 'AL' => 'Albanie',
  747. 'MK' => 'Macédoine du Nord',
  748. 'ME' => 'Monténégro',
  749. 'XK' => 'Kosovo',
  750. 'IS' => 'Islande',
  751. 'LU' => 'Luxembourg',
  752. 'MT' => 'Malte',
  753. 'CY' => 'Chypre',
  754. 'AD' => 'Andorre',
  755. 'MC' => 'Monaco',
  756. 'SM' => 'Saint-Marin',
  757. 'VA' => 'Vatican',
  758. 'LI' => 'Liechtenstein',
  759. 'UY' => 'Uruguay',
  760. 'PY' => 'Paraguay',
  761. 'BO' => 'Bolivie',
  762. 'EC' => 'Équateur',
  763. 'GY' => 'Guyana',
  764. 'SR' => 'Suriname',
  765. 'GF' => 'Guyane française',
  766. 'FK' => 'Îles Malouines',
  767. 'GS' => 'Géorgie du Sud-et-les Îles Sandwich du Sud',
  768. 'CU' => 'Cuba',
  769. 'JM' => 'Jamaïque',
  770. 'HT' => 'Haïti',
  771. 'DO' => 'République dominicaine',
  772. 'PR' => 'Porto Rico',
  773. 'TT' => 'Trinité-et-Tobago',
  774. 'BB' => 'Barbade',
  775. 'BS' => 'Bahamas',
  776. 'BZ' => 'Belize',
  777. 'GT' => 'Guatemala',
  778. 'HN' => 'Honduras',
  779. 'SV' => 'Salvador',
  780. 'NI' => 'Nicaragua',
  781. 'CR' => 'Costa Rica',
  782. 'PA' => 'Panama',
  783. ];
  784. if ($this->isoCode && isset($isoCodeMapping[$this->isoCode])) {
  785. $this->countryNameFr = $isoCodeMapping[$this->isoCode];
  786. } else {
  787. // Si aucun mapping n'est trouvé, on garde le nom anglais
  788. $this->countryNameFr = $this->countryName;
  789. }
  790. return $this;
  791. }
  792. }