babelfish


Namebabelfish JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/Diaoul/babelfish
SummaryA module to work with countries and languages
upload_time2021-08-09 17:02:29
maintainer
docs_urlhttps://pythonhosted.org/babelfish/
authorAntoine Bertin
requires_python>=3.6,<4.0
licenseBSD-3-Clause
keywords language country locale
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BabelFish
BabelFish is a Python library to work with countries and languages.

[![tests](https://github.com/Diaoul/babelfish/actions/workflows/test.yml/badge.svg)](https://github.com/Diaoul/babelfish/actions/workflows/test.yml)

## 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):
```python
>>> import babelfish
>>> script = babelfish.Script('Hira')
>>> script
<Script [Hira]>
```

### Country
Country representation from 2-letter code (ISO-3166):
```python
>>> country = babelfish.Country('GB')
>>> country
<Country [GB]>
```

Built-in country converters (name):
```python
>>> country = babelfish.Country('GB')
>>> country
<Country [GB]>
```

### Language
Language representation from 3-letter code (ISO-639-3):
```python
>>> language = babelfish.Language("eng")
>>> language
<Language [en]>
```

Country-specific language:
```python
>>> language = babelfish.Language('por', 'BR')
>>> language
<Language [pt-BR]>
```

Language with specific script:
```python
>>> 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):
```python
>>> 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](http://opensource.org/licenses/BSD-3-Clause>)

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Diaoul/babelfish",
    "name": "babelfish",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/babelfish/",
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "language,country,locale",
    "author": "Antoine Bertin",
    "author_email": "ant.bertin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/02/0d/e72bf59672ebceae99cd339106df2b0d59964e00a04f7286ae9279d9da6c/babelfish-0.6.0.tar.gz",
    "platform": "",
    "description": "# BabelFish\nBabelFish is a Python library to work with countries and languages.\n\n[![tests](https://github.com/Diaoul/babelfish/actions/workflows/test.yml/badge.svg)](https://github.com/Diaoul/babelfish/actions/workflows/test.yml)\n\n## Usage\nBabelFish provides scripts, countries and languages from their respective ISO\nstandards and a handy way to manipulate them with converters.\n\n### Script\nScript representation from 4-letter code (ISO-15924):\n```python\n>>> import babelfish\n>>> script = babelfish.Script('Hira')\n>>> script\n<Script [Hira]>\n```\n\n### Country\nCountry representation from 2-letter code (ISO-3166):\n```python\n>>> country = babelfish.Country('GB')\n>>> country\n<Country [GB]>\n```\n\nBuilt-in country converters (name):\n```python\n>>> country = babelfish.Country('GB')\n>>> country\n<Country [GB]>\n```\n\n### Language\nLanguage representation from 3-letter code (ISO-639-3):\n```python\n>>> language = babelfish.Language(\"eng\")\n>>> language\n<Language [en]>\n```\n\nCountry-specific language:\n```python\n>>> language = babelfish.Language('por', 'BR')\n>>> language\n<Language [pt-BR]>\n```\n\nLanguage with specific script:\n```python\n>>> language = babelfish.Language.fromalpha2('sr')\n>>> language.script = babelfish.Script('Cyrl')\n>>> language\n<Language [sr-Cyrl]>\n```\n\nBuilt-in language converters (alpha2, alpha3b, alpha3t, name, scope, type and opensubtitles):\n```python\n>>> language = babelfish.Language('por', 'BR')\n>>> language.alpha2\n'pt'\n>>> language.scope\n'individual'\n>>> language.type\n'living'\n>>> language.opensubtitles\n'pob'\n>>> babelfish.Language.fromalpha3b('fre')\n<Language [fr]>\n```\n\n## License\nBabelFish is licensed under the [3-clause BSD license](http://opensource.org/licenses/BSD-3-Clause>)\n\nCopyright (c) 2013, the BabelFish authors and contributors.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A module to work with countries and languages",
    "version": "0.6.0",
    "split_keywords": [
        "language",
        "country",
        "locale"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "7ebcbccac16bfd70c7fe09eeffc1201d",
                "sha256": "268f1c6279f2a04a66837972e8a9f3dcc68e16f1201eec57d2a4b828a8b41b11"
            },
            "downloads": -1,
            "filename": "babelfish-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ebcbccac16bfd70c7fe09eeffc1201d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 93560,
            "upload_time": "2021-08-09T17:02:28",
            "upload_time_iso_8601": "2021-08-09T17:02:28.765535Z",
            "url": "https://files.pythonhosted.org/packages/ce/2c/f7951f771261da6740af14fd9698064616aa040780cd8a03243fc43165c7/babelfish-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "985464e05a7fd275d650347af8aa2439",
                "sha256": "2dadfadd1b205ca5fa5dc9fa637f5b7933160a0418684c7c46a7a664033208a2"
            },
            "downloads": -1,
            "filename": "babelfish-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "985464e05a7fd275d650347af8aa2439",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 87807,
            "upload_time": "2021-08-09T17:02:29",
            "upload_time_iso_8601": "2021-08-09T17:02:29.815037Z",
            "url": "https://files.pythonhosted.org/packages/02/0d/e72bf59672ebceae99cd339106df2b0d59964e00a04f7286ae9279d9da6c/babelfish-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-08-09 17:02:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Diaoul",
    "github_project": "babelfish",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "babelfish"
}
        
Elapsed time: 0.02470s