GithubHelp home page GithubHelp logo

rizquuula / bcp47.py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from highfestiva/bcp47.py

0.0 1.0 0.0 27 KB

BCP47 LCID language codes, plain and simple

License: MIT License

Python 99.64% Shell 0.36%

bcp47.py's Introduction

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!

bcp47.py's People

Contributors

highfestiva avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.