Skip to main content

Language tags made easy

Project description

BCP47

Language tags are not your everyday ISO standard, but instead composed of an ISO-639 language code, and an ISO-3166 country/region code (and occationally an ISO-15924 script tag for the written language).

The file is generated from Microsoft's seminal piece, [MS-LCID].pdf.

Easy installation

$ pip install bcp47

Example

>>> import bcp47

>>> 'dje' in bcp47.tags and 'es-DO' in bcp47.tags
True

>>> [v for k,v in bcp47.languages.items() if 'English' in k]
['en', 'en-AS', 'en-AI', 'en-AG', 'en-AU', 'en-AT', 'en-BS', 'en-BB', 'en-BE', 'en-BZ', 'en-BM', 'en-BW', 'en-IO', ...]

Discontentment

This package only lists the most common language codes. If you want a package to parse, validate and simplify full BCP47 language tags, have a look at langcodes or langtags.

The BCP47 standard is 84 pages catering to specificity (such as de-CH-1996 and zh-CN-a-myext-x-private) while this package currently does not. Instead a highly pragmatic approach is used (some say overly simplified) where only the most common 900 or so language codes are listed, such as fo-DK and iu-Cans-CA.

Microsoft's language codes are used to ensure some level of pragmatism, KISS. Validation you will have to do yourself, see above for a trivial example.

Enjoy at the best of your ability!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bcp47-0.1.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

bcp47-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file bcp47-0.1.0.tar.gz.

File metadata

  • Download URL: bcp47-0.1.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for bcp47-0.1.0.tar.gz
Algorithm Hash digest
SHA256 37cc7a03fd696149ebfe7de785c5bad473f911eddac8415cf479584049cf03d5
MD5 186e8968131f7f2a44de5afc17bd5d2f
BLAKE2b-256 3566259eed040158b4e4df04fdf2c9f5f6387dfb155e7005d8522b588a700ea7

See more details on using hashes here.

File details

Details for the file bcp47-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bcp47-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for bcp47-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a567b7fe881c900916a9db62ac8f792370c7ddf2664e601b74eeed35d8758aa5
MD5 2193345d182227beee216422746bf409
BLAKE2b-256 635a33251b8d10e7f9e13caacc307629595a0fe7cc516100d44ad8fc4ef98a5d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page