iso-langcodes
Python modules for working with language codes, language groups and language scripts.
Currently, there are 3 modules in this package:
iso_langcodes.iso639_3- conversion between ISO language codesiso_langcodes.iso639_5- language groups and families according to ISO 639-5iso_langcodes.iso15924- language scripts and their connection to languages
Installation
pip install iso-langcodes
Or install from source:
pip install .
Usage
ISO 639-3
from iso_langcodes import iso639_3
print(iso639_3.convert_iso639('iso639-1', 'fra'))
print(iso639_3.convert_iso639('iso639-3', 'de'))
print(iso639_3.convert_iso639('name', 'fa'))
print(iso639_3.get_iso639_1('deu'))
print(iso639_3.get_iso639_3('de'))
print(iso639_3.get_language_name('de'))
print(iso639_3.get_language_name('eng'))
print(iso639_3.get_macro_language('yue'))
ISO 639-5
from iso_langcodes import iso639_5
print(' '.join(iso639_5.language_group('gmw')))
print(' '.join(iso639_5.language_group('gem')))
print(' '.join(iso639_5.language_group_children('gem')))
print(iso639_5.language_parent('afr'))
print(iso639_5.language_parent('gmw'))
ISO 15924
from iso_langcodes import iso15924
script = iso15924.script_of_string('То је моја мачка.', 'srp')
script = iso15924.script_of_string('你是我妈妈。')
scripts = iso15924.script_of_string('То је моја мачка. Ti si moja majka.', allow_non_standard=True)
region = iso15924.default_territory('por')
script = iso15924.default_script('tur')
Command Line Tools
The package provides three command-line tools:
iso639
Convert between language codes:
iso639 fra de eng
iso639 -2 fra deu
iso639 -3 de
iso639 -m yue
langgroup
Print language groups according to ISO 639-5:
langgroup gem
langgroup -c gem
langgroup -p afr gmw
langscript
Detect characters from various scripts:
echo "То је моја мачка." | langscript -l srp
echo "你是我妈妈。" | langscript
langglottolog
Convert between ISO 639-5 codes and Glottolog codes:
langglottolog aav afa alg
langglottolog -g aust1305 afro1255
License
This software is Copyright (c) 2020 by Joerg Tiedemann.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Acknowledgements
The language codes are taken from SIL International https://iso639-3.sil.org. Please, check the terms of use listed at https://iso639-3.sil.org/code_tables/download_tables. The current version uses the UTF-8 tables distributed in "iso-639-3_Code_Tables_20200130.zip" from that website. This module adds some non-standard codes that are not specified in the original tables to be compatible with some ad-hoc solutions in some resources and tools.
The official ISO 15924 code list is taken from Unicode https://www.unicode.org/iso15924/iso15924.txt.zip and the additional information about connections between languages, scripts and territories is extracted from the Unicode CLDR project at http://cldr.unicode.org.
Metadata
Release files for iso-langcodes 1.0.0
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 | |
|---|---|---|---|---|
| iso_langcodes-1.0.0.tar.gz | 232.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iso_langcodes-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 472.5 kB
Release files / iso_langcodes-1.0.0.tar.gz
| Download URL | iso_langcodes-1.0.0.tar.gz |
|---|---|
| Size | 232.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97967155986ac34a0b4212a8dcc670c411a4d7135877f0e247774613e7970e10
|
|
BLAKE2b-256 checksum How to use checksums |
8a9c676c6155e639c56cc942136a0de219887662fb9a6a7eb31ecff6bd23a31a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / iso_langcodes-1.0.0-py3-none-any.whl
| Download URL | iso_langcodes-1.0.0-py3-none-any.whl |
|---|---|
| Size | 239.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
205e7222f06fd5c9eaf6e31e224bdbdbf2f7c8870ee148cd3aa559a2aec2d858
|
|
BLAKE2b-256 checksum How to use checksums |
e08c06d1a0f524d1276e67a6bd2e26efa4b4c68cf6e13d4403650e81ad8a9d60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for iso-langcodes 1.0.0
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.