Status
License
GNU Affero General Public License version 3 (AGPLv3)
Supports
ISO 639-1
ISO 639-2
ISO 639-3
ISO 639-5
Breaking changes
0.4.4: retired has been changed to { ‘code’: (datetime, [_Language, …], ‘description’) }.
0.4.0: alpha3 has been renamed to part3. languages.alpha3 might be used as an aggregation of all ‘three letter codes’ in the future.
Compatibility
This library is aimed to be fully compatible with pycountry.languages v1.11 and before. In v1.12 they broke their own API and this library will not support the new API.
It provides the following attribute abstractions:
terminology -> part2t
bibliographic -> part2b
alpha2 -> part1
If you have no intentions on using pycountry.languages or want/need to keep compatibility then please use the partX attributes for brevity and clarity.
Usage
As taken from pycountry.languages v1.11 documentation, with modifications and further additions.
>>> from iso639 import languages
>>> from pprint import pprint
>>> len(languages)
7981
>>> type(list(languages)[0])
<class 'iso639.iso639._Language'>
# Compatibility
>>> aragonese = languages.get(alpha2='an')
>>> aragonese.alpha2
'an'
>>> aragonese.bibliographic
'arg'
>>> aragonese.terminology
'arg'
>>> aragonese.name
'Aragonese'
>>> bengali = languages.get(alpha2='bn')
>>> bengali.name
'Bengali'
# We *do not* deviate from the standard
>>> try:
... bengali.common_name
... except AttributeError as e:
... print(e)
'_Language' object has no attribute 'common_name'
# New API
>>> aragonese = languages.get(part1='an')
>>> aragonese.part1
'an'
>>> aragonese.part2b
'arg'
>>> aragonese.part2t
'arg'
>>> aragonese.part3
'arg'
>>> aragonese.name
'Aragonese'
>>> aragonese.inverted
'Aragonese'
>>> pprint(vars(aragonese))
{'inverted': 'Aragonese',
'macro': '',
'name': 'Aragonese',
'names': [],
'part1': 'an',
'part2b': 'arg',
'part2t': 'arg',
'part3': 'arg',
'part5': ''}
>>> sanapana = languages.get(retired='sap')
>>> [type(elem).__name__ for elem in sanapana]
['datetime', 'list', 'str']
>>> [lang.part3 for lang in sanapana[1]]
['spn', 'aqt']
Contains external data
ISO 639-1, on 2014-11-28
ISO 639-2, on 2014-11-28
ISO 639-3 Code Set, dated 2015-05-05
ISO 639-3 Language Names Index, dated 2015-05-05
ISO 639-3 Macrolanguage Mappings, dated 2015-05-05
ISO 639-3 Retired Code Element Mappings, dated 2015-05-05
ISO 639-5, dated 2011-05-12
Metadata
Release files for iso-639 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iso-639-0.4.5.tar.gz | 167.4 kB | Without provenance | Details for iso-639-0.4.5.tar.gz |
Release files / iso-639-0.4.5.tar.gz
| Download URL | iso-639-0.4.5.tar.gz |
|---|---|
| Size | 167.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc9cd4b880b898d774c47fe9775167404af8a85dd889d58f9008035109acce49
|
|
BLAKE2b-256 checksum How to use checksums |
5a8d27969852f4e664525c3d070e44b2b719bc195f4d18c311c52e57bb93614e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for iso-639 0.4.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.