Metadata-Version: 2.4
Name: langbly
Version: 0.1.0
Summary: Official Python SDK for the Langbly translation API
Project-URL: Homepage, https://langbly.com
Project-URL: Documentation, https://langbly.com/docs
Project-URL: Repository, https://github.com/Langbly/langbly-python
Project-URL: Issues, https://github.com/Langbly/langbly-python/issues
Author-email: Jasper de Winter <jasper@langbly.com>
License-Expression: MIT
License-File: LICENSE
Keywords: api,google-translate,i18n,langbly,localization,translation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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: Topic :: Software Development :: Libraries
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: respx>=0.20; extra == 'dev'
Description-Content-Type: text/markdown

# langbly-python

Official Python SDK for the [Langbly](https://langbly.com) translation API — a drop-in replacement for Google Translate v2.

## Installation

```bash
pip install langbly
```

## Quick Start

```python
from langbly import Langbly

client = Langbly(api_key="your-api-key")

# Translate text
result = client.translate("Hello world", target="nl")
print(result.text)  # "Hallo wereld"

# Batch translate
results = client.translate(["Hello", "Goodbye"], target="nl")
for r in results:
    print(r.text)

# Detect language
detection = client.detect("Bonjour le monde")
print(detection.language)  # "fr"
```

## Google Translate Migration

If you're using `google-cloud-translate`, switching is simple:

```python
# Before (Google)
from google.cloud import translate_v2 as translate
client = translate.Client()
result = client.translate("Hello", target_language="nl")

# After (Langbly)
from langbly import Langbly
client = Langbly(api_key="your-key")
result = client.translate("Hello", target="nl")
```

## API Reference

### `Langbly(api_key, base_url=None)`

Create a client instance.

- `api_key` (str): Your Langbly API key
- `base_url` (str, optional): Override the API URL (default: `https://api.langbly.com`)

### `client.translate(text, target, source=None, format=None)`

Translate text.

- `text` (str | list[str]): Text(s) to translate
- `target` (str): Target language code (e.g., "nl", "de", "fr")
- `source` (str, optional): Source language code (auto-detected if omitted)
- `format` (str, optional): "text" or "html"

### `client.detect(text)`

Detect the language of text.

- `text` (str): Text to analyze

### `client.languages(target=None)`

List supported languages.

- `target` (str, optional): Language code to return names in

## License

MIT
