Skip to main content

Languager


ISO639 Language Service

This module identifies languages from ISO639-1 and ISO639-3 codes or ISO names and provides a convenient class to access related attributes. It is also possible to lookup codes for languages based on their ISO names. However, the name based lookup will be slower as all language names are compared in lowercase for that.

Basic flows:

  • Code is 2 characters
    • Lookup long code
    • Lookup data
  • Code is 3 characters
    • Lookup data
  • Code is something else
    • Loop all language names to check for match
      • input_language == language_name.lower()
    • Lookup data

This means that that Name based lookup is n-times slower than the other two options. But this really should not make a difference.

Data

The data is taken from iso639-3.sil.org and is stored in the tables folder. Further releases will update these tables.

Code

The code in generator.py generates a single python file that contains all lookup tables and methods.

Language

  • code: The ISO639-3 Code
  • short: ISO639-1 Code if available
  • deprecated: True if the definition is deprecated
  • macro: True if this is in a macrolanguage gropup
  • parent: The parent macrolanguage
  • macros: Any languages belonging to this macrolanguage

Examples

Checking the macrolanguages for Chinese:

from languager import get_language

lang = get_language('zho')
# lang = get_language('zh')
# lang = get_language('Chinese')
# lang = get_language('does not exist', default='zho')

for language in lang.macros:
    print(language)

# czo
# csp
# yue
# cnp
# cmn
# czh
# hak
# nan
# wuu
# cjy
# lzh
# gan
# mnp
# cpx
# hsn
# cdo

Metadata

Release files for languager 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for languager 1.0.0
File Size Uploaded Provenance Actions
languager-1.0.0.tar.gz 75.8 kB Without provenance Details for languager-1.0.0.tar.gz

Release files / languager-1.0.0.tar.gz

Download URL languager-1.0.0.tar.gz
Size 75.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4862a77bc2b67ab4a6aa486c181fadeb715982e73025ed09c0b51ed5f5e4b9b0
BLAKE2b-256 checksum
How to use checksums
f7f9491f564cc64a3ada1242fb1c0e1c3b69897bce3738268a2dd3517c162da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9

Security for languager 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page