Skip to main content

A module to work with countries and languages

Project description


BabelFish is a Python library to work with countries and languages.



BabelFish provides scripts, countries and languages from their respective ISO standards and a handy way to manipulate them with converters.


Script representation from 4-letter code (ISO-15924):

>>> import babelfish
>>> script = babelfish.Script('Hira')
>>> script
<Script [Hira]>


Country representation from 2-letter code (ISO-3166):

>>> country = babelfish.Country('GB')
>>> country
<Country [GB]>

Built-in country converters (name):

>>> country = babelfish.Country('GB')
>>> country
<Country [GB]>


Language representation from 3-letter code (ISO-639-3):

>>> language = babelfish.Language("eng")
>>> language
<Language [en]>

Country-specific language:

>>> language = babelfish.Language('por', 'BR')
>>> language
<Language [pt-BR]>

Language with specific script:

>>> language = babelfish.Language.fromalpha2('sr')
>>> language.script = babelfish.Script('Cyrl')
>>> language
<Language [sr-Cyrl]>

Built-in language converters (alpha2, alpha3b, alpha3t, name, scope, type and opensubtitles):

>>> language = babelfish.Language('por', 'BR')
>>> language.alpha2
>>> language.scope
>>> language.type
>>> language.opensubtitles
>>> babelfish.Language.fromalpha3b('fre')
<Language [fr]>


BabelFish is licensed under the 3-clause BSD license

Copyright (c) 2013, the BabelFish authors and contributors.

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

babelfish-0.6.0.tar.gz (87.8 kB view hashes)

Uploaded source

Built Distribution

babelfish-0.6.0-py3-none-any.whl (93.6 kB view hashes)

Uploaded py3

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