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!
Metadata
Release files for bcp47 0.2.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 | |
|---|---|---|---|
| bcp47-0.2.0.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bcp47-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.9 kB
Release files / bcp47-0.2.0.tar.gz
| Download URL | bcp47-0.2.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0dd36374e0036bc53927b71ed5a36c4914a0c8f3486f7334fcedd2dd3c93660
|
|
BLAKE2b-256 checksum How to use checksums |
341b8293599b7a2ad0dcd9b7cdf7576606c4e1199d734a1aaa4bef33360abf67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.1
|
Release files / bcp47-0.2.0-py3-none-any.whl
| Download URL | bcp47-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ddecca5bc3d8f05caeaebe6430f1db18c1bc0eb44aeb8061af9970477b09bcc
|
|
BLAKE2b-256 checksum How to use checksums |
f229af495f196786f90f7d36ecf6babe7cc321ec4429b4a2c6ca3d37128aca99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.1
|