You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.9 KiB
106 lines
2.9 KiB
Metadata-Version: 2.1
|
|
Name: babelfish
|
|
Version: 0.6.0
|
|
Summary: A module to work with countries and languages
|
|
Home-page: https://github.com/Diaoul/babelfish
|
|
License: BSD-3-Clause
|
|
Keywords: language,country,locale
|
|
Author: Antoine Bertin
|
|
Author-email: ant.bertin@gmail.com
|
|
Requires-Python: >=3.6,<4.0
|
|
Classifier: Development Status :: 5 - Production/Stable
|
|
Classifier: Intended Audience :: Developers
|
|
Classifier: License :: OSI Approved :: BSD License
|
|
Classifier: Operating System :: OS Independent
|
|
Classifier: Programming Language :: Python
|
|
Classifier: Programming Language :: Python :: 3
|
|
Classifier: Programming Language :: Python :: 3.6
|
|
Classifier: Programming Language :: Python :: 3.7
|
|
Classifier: Programming Language :: Python :: 3.8
|
|
Classifier: Programming Language :: Python :: 3.9
|
|
Classifier: Programming Language :: Python :: 3.10
|
|
Classifier: Programming Language :: Python :: 3.11
|
|
Classifier: Programming Language :: Python :: 3.12
|
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
Classifier: Topic :: Software Development :: Internationalization
|
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
Project-URL: Repository, https://github.com/Diaoul/babelfish
|
|
Description-Content-Type: text/markdown
|
|
|
|
# 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.
|
|
|