Skip to main content

BabelFish

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

tests

Usage

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

Script

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

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

Country

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

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

Built-in country converters (name):

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

Language

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
'pt'
>>> language.name
'Portuguese'
>>> language.scope
'individual'
>>> language.type
'living'
>>> language.opensubtitles
'pob'
>>> babelfish.Language.fromalpha3b('fre')
<Language [fr]>

License

BabelFish is licensed under the 3-clause BSD license

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

Release files for babelfish 0.6.1

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

Source distribution (sdist)

Source distribution for babelfish 0.6.1
File Size Uploaded
babelfish-0.6.1.tar.gz 87.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for babelfish 0.6.1
File Interpreter ABI Platform
babelfish-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 181.9 kB

Release files / babelfish-0.6.1.tar.gz

Download URL babelfish-0.6.1.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
decb67a4660888d48480ab6998309837174158d0f1aa63bebb1c2e11aab97aab
BLAKE2b-256 checksum
How to use checksums
c58f17ff889327f8a1c36a28418e686727dabc06c080ed49c95e3e2424a77aa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1018-azure

Release files / babelfish-0.6.1-py3-none-any.whl

Download URL babelfish-0.6.1-py3-none-any.whl
Size 94.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
512f1501d4c8f7d38f0921f48660be7542de1a7b24abb6a6a65324a670150293
BLAKE2b-256 checksum
How to use checksums
95a1bd4f759db13cd8beb9c9f68682aced5d966781b9d7380cf514a306f56762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1018-azure

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

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