Skip to main content

A module to work with countries and languages

Project description

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('GB')
>>> 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.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.

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.0b1.tar.gz (87.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file babelfish-0.6.0b1.tar.gz.

File metadata

  • Download URL: babelfish-0.6.0b1.tar.gz
  • Upload date:
  • Size: 87.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.8.0-1036-azure

File hashes

Hashes for babelfish-0.6.0b1.tar.gz
Algorithm Hash digest
SHA256 08003759a6517ae102eba290185582cc91f062003d602a947b435f581b89ab45
MD5 bfcd40ea0075f63d6d836b3443e25e86
BLAKE2b-256 a038ba38e24d7d4131db248ae90332ffafc8a0df2ec167da7de9aae026b67feb

See more details on using hashes here.

File details

Details for the file babelfish-0.6.0b1-py3-none-any.whl.

File metadata

  • Download URL: babelfish-0.6.0b1-py3-none-any.whl
  • Upload date:
  • Size: 93.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.8.0-1036-azure

File hashes

Hashes for babelfish-0.6.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e47e2f95bdd85eeb781a702d3f1a56e3207715d41b55615127b097af34b50b6
MD5 688502c7db041a70104a4fd878a4e69c
BLAKE2b-256 d8f059b7d26c5f256f3d5174abd3b28e37d19850afaf35a641fb73eab0942646

See more details on using hashes here.

Supported by

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