HerbezMedia Country Selector

Plugin pour la création d’un sélécteur de langue libre et gratuit

HM-Country Selector est un plugin développé par HerbezMedia afin de faciliter la creation et l’intégration d’un sélécteur de pays sur un site wordpress.

Il offre un solution libre et gratuite pour l’ajout d’un composant permettant la séléction de pays avec plusieurs details dont:
Indicatif téléphonique
Drapeau du pays
Les langues assocées au pays

Il offre aussi une facilité pour la modification du composant avec une documentation claire, que vous trouverez au bas de cette page.

Si le composant vous plait, n’hésitez pas à me laisser un commentaire, ou m’envoyer un mail à:

maxime@herbezmedia.ch

HM Country Selector

Profitez dès maintenant d’une solution performante et légère pour vos projets WordPress. Je mets gratuitement à votre disposition l’extension HM Country Selector pour vous aider à gagner un temps précieux.

Inclus : Code source ouvert et liberté totale de modification.

Credits

Merci à Lipis pour les images des drapeaux des pays https://github.com/lipis
Site web: https://flagicons.lipis.dev/

Merci aussi à Luke Duncalfe pour le formatage des noms iso des pays https://github.com/lukes


+355

Albanie

SHQ
+49

Allemagne

DEU
+376

Andorre

CAT
+43

Autriche

DEU
+32

Belgique

NED FRA DEU
+375

Biélorussie

РУС
+387

Bosnie-Herzégovine

BOS HRV СРП
+359

Bulgarie

БЪЛ
+357

Chypre

ΕΛΛ TÜR
+39 06 698

Cité du Vatican

ITA
+385

Croatie

HRV
+45

Danemark

DAN
+34

Espagne

ESP CAT GAL EUS
+372

Estonie

EES
+358

Finlande

SUO SVE
+33

France

FRA
+30

Grèce

ΕΛΛ
+36

Hongrie

MAG
+353

Irlande

ENG
+354

Islande

ÍSL
+39

Italie

ITA
+383

Kosovo

SHQ СРП
+371

Lettonie

LAT
+423

Liechtenstein

DEU
+370

Lituanie

LIE
+352

Luxembourg

FRA DEU
+389

Macédoine du Nord

МАК SHQ
+356

Malte

ENG
+373

Moldavie

ROM
+377

Monaco

FRA
+382

Monténégro

СРП
+47

Norvège

NOR NOR
+31

Pays-Bas

NED
+48

Pologne

POL
+351

Portugal

POR
+40

Roumanie

ROM
+44

Royaume-Uni

ENG
+420

République tchèque

ČEŠ
+39 0549

Saint-Marin

ITA
+381

Serbie

СРП
+421

Slovaquie

SLO
+386

Slovénie

SLO
+41

Suisse

DEU FRA ITA
+46

Suède

SVE
+380

Ukraine

УКР

hmcsl api reference

HTML/JS

document

listener: hmcsl_countrySelectorOutsideListener

is responsible of closing the country selector on click outside of component

tag country-selector

listener: hmcsl_insideClickListener

is responsible of action of click inside compoenent

boolean: isOpen

      indicate if the country selector is open

function: close

close the country selector

function open

open the country select

string: value

indicates the current value of the countrySelector

dispatched_events:

input

change

tag country

listener: hmcsl_clickListener

is responsible for selecting a country in a list

PHP

hmcsl_get_countries() :array

returns a map of country_items, present in the countries directory: details, index by country name in english

[

‘Albania’=>

[‘languages’=>

[

0 => [

‘language’=>’sq’,

        ‘english_name=>‘Albanian’,

        ’native_name’=>’Shqip'

]

]

"country_name" => 'Albania',

"country_name_de" => ‘Albanien’,

"country_name_fr" => 'Albanie’, 

"country_name_it" => ‘Albania’,

                 "country_name_pt" => ‘Albânia’,

"country_name_es" => ‘Albania'

]

...

]

string $initial_value if we want to select a specified country in the list, must be the country name in english and in lowercase

hmcsl_get_country_selector($initial_value = null) : string

returns the formatted html element

hmcsl_country_selector($initial_value = null)

print the component on the page