Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
i18n-iso-countries
i18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes
Readme
i18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes from: Wiki
pip install i18n-iso-countries
from i18n_iso_countries import get_country_name
get_country_name(code="US", language='en') # United States of America
get_country_name(code="US", language='de') # Vereinigte Staaten von Amerika
get_country_name(code="USA", language='en') # United States of America
get_country_name(code="840", language='en') # United States of America
from i18n_iso_countries import get_country_name
# Some countries have alias/short names defined. `select` is used to control which
# name will be returned.
get_country_name(code="GB", language='en', select="official") # United Kingdom
get_country_name(code="GB", language='en', select="alias") # UK
get_country_name(code="GB", language='en', select="all") # ["United Kingdom", "UK", "Great Britain"]
# Countries without an alias will always return the offical name
get_country_name(code="LT", language='en', select="official") # Lithuania
get_country_name(code="LT", language='de', select="alias") # Lithuania
get_country_name(code="LT", language='en', select="all") # ["Lithuania"]
from i18n_iso_countries import get_country_name
get_country_name(language='en', select="official") # { 'AF': 'Afghanistan', 'AL': 'Albania', [...], 'ZM': 'Zambia', 'ZW': 'Zimbabwe' }
from i18n_iso_countries import get_supported_languages
get_supported_languages() # ["cy", "dv", "sw", "eu", "af", "am", ...]
In case you want to add new language, please refer [ISO 639-1 table][iso:639-1].
af
: Afrikaansam
: Amharicar
: Arabicaz
: Azerbaijanibe
: Belorussianbg
: Bulgarianbn
: Bengalibs
: Bosnianca
: Catalancs
: Czechcy
: Cymraegda
: Danishde
: Germandv
: Dhivehien
: Englishes
: Spanishet
: Estonianeu
: Basquefa
: Persianfi
: Finnishfr
: Frenchgl
: Galicianel
: Greekha
: Hausahe
: Hebrewhi
: Hindihr
: Croatianhu
: Hungarianhy
: Armenianis
: Icelandicit
: Italianid
: Indonesianja
: Japaneseka
: Georgiankk
: Kazakhkm
: Khmerko
: Koreanku
: Kurdishky
: Kyrgyzlt
: Lithuanianlv
: Latvianmk
: Macedonianml
: Malayalammn
: Mongolianms
: Malaynb
: Norwegian Bokmålnl
: Dutchnn
: Norwegian Nynorskno
: Norwegianpl
: Polishps
: Pashtopt
: Portuguesero
: Romanianru
: Russiansd
: Sindhisk
: Slovaksl
: Sloveneso
: Somalisq
: Albaniansr
: Serbiansv
: Swedishsw
: Swahilita
: Tamiltg
: Tajikth
: Thaitr
: Turkishtt
: Tatarug
: Uyghuruk
: Ukrainianur
: Urduuz
: Uzbekzh
: Chinesevi
: Vietnamesefrom i18n_iso_countries import alpha3_to_alpha2
alpha3_to_alpha2('USA') #US
from i18n_iso_countries import numeric_to_alpha2
numeric_to_alpha2('840') # US
from i18n_iso_countries import alpha2_to_alpha3
alpha2_to_alpha3('DE') # DEU
from i18n_iso_countries import numeric_to_alpha3
numeric_to_alpha3('840') # USA
from i18n_iso_countries import alpha3_to_numeric
alpha3_to_numeric('SWE') #752
from i18n_iso_countries import alpha2_to_numeric
alpha2_to_numeric("SE") # 752
from i18n_iso_countries import get_alpha2_codes
get_alpha2_codes() # { 'AF': 'AFG', 'AX': 'ALA', [...], 'ZM': 'ZMB', 'ZW': 'ZWE' }
from i18n_iso_countries import get_alpha3_codes
get_alpha3_codes() # { 'AFG': 'AF', 'ALA': 'AX', [...], 'ZMB': 'ZM', 'ZWE': 'ZW' }
from i18n_iso_countries import get_numeric_codes
get_numeric_codes() # { '004': 'AF', '008': 'AL', [...], '887': 'YE', '894': 'ZM' }
from i18n_iso_countries import is_valid_country_code
is_valid_country_code("US") # True
is_valid_country_code("USA") # True
is_valid_country_code("XX") # False
FAQs
i18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes
We found that i18n-iso-countries demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.