Skip to main content

DeepL translation plugin for Sopel IRC bots.

Project description

sopel-deepl

DeepL translation plugin for Sopel IRC bots.

Installation

This plugin is released on PyPI, so it's easy to install using pip:

pip install sopel-deepl

Sopel loads all available plugins by default. If you have changed your bot to the "enabled only" mode, edit your config file to enable the deepl plugin or run sopel-plugins enable deepl in your terminal.

Usage

.deepl [text to translate]

# Totally-not-contrived example
<dgw> .deepl Dormez-vous?
<Sopel> [DeepL] "Are you asleep?" (FR 🡒 EN-US)

The target language can be configured globally, with overrides at the channel and user levels via IRC commands; see below.

Configuring global settings

The easiest way to configure this plugin is using Sopel's built-in wizard: In your terminal, run sopel-plugins configure deepl and follow the prompts.

These settings are also configurable by editing the [deepl] section of your bot's config file manually, if you choose.

[deepl]
auth_key = your_DeepL_API_key  # required
default_target = FR  # optional; defaults to EN-US

Refer to DeepL's list of supported target languages when choosing a value for default_target.

Configuring user settings

# set to French
.deeplang FR

# clear user preference
.deeplang -

Users can set their preferred target language for translations using the .deeplang command. See DeepL's supported target languages.

The special value - clears this setting.

Configuring channel settings

# set to French
.deepclang FR

# clear channel setting
.deepclang -

Channel operators and higher can set a channel's default target language, overriding the bot's global default, using the .deepclang command. See DeepL's list of supported target languages.

The special value - clears this setting.

Limitations

In some cases, it might be useful to pass a source-language hint along with the input text. DeepL's language detection is fairly good when given well-formed source material, but it can make wild incorrect guesses on "wrong" usage. (For example, passing the earlier Dormez-vous? example without the hyphen yielded a guessed source language of Hungarian instead of French during testing.)

sopel-deepl doesn't support such a feature yet, but it's on the radar.

Changelog

0.2.0

Added:

  • Bot-level default target language setting (#3)
    English is no longer the only supported translation target! 🎉
  • User & channel preferences for target language (#3)
    These are configured through IRC commands; see README.

Changed:

  • Require Sopel 8.0+; Sopel 7.x and Python <= 3.7 are no longer supported (#1)
  • Use first-party deepl library instead of unofficial deepl-api (#5)

Meta:

  • Filled out README documentation (#5)
  • Converted to pyproject.toml package with future-proofing (#1)
  • Miscellaneous code style tweaks & modernization

0.1.0

First release of sopel-deepl with basic translate-to-English functionality.

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

sopel_deepl-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

sopel_deepl-0.2.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file sopel_deepl-0.2.0.tar.gz.

File metadata

  • Download URL: sopel_deepl-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sopel_deepl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1248a8b15695ca024745055a2e3d9a6a74532f73e8cdabaf2c17051d68d30922
MD5 473d5366c8d0a9acf2613b221731058e
BLAKE2b-256 bdb1ded167cbe5cd4cd4021b6ce19590c582c68a60d75b32b551a12b14e43737

See more details on using hashes here.

Provenance

The following attestation bundles were made for sopel_deepl-0.2.0.tar.gz:

Publisher: pypi.yml on dgw/sopel-deepl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sopel_deepl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sopel_deepl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sopel_deepl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a23cb5eb8047f29a67146a47f935bebfbcb61c931b03823a13d4a375d77f092
MD5 1b0fa6df03acc33242873be5787a14e5
BLAKE2b-256 8c3cd7a921e82813fde3363fb5a11d035e8681dbc887a017435fa3d2978b81c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for sopel_deepl-0.2.0-py3-none-any.whl:

Publisher: pypi.yml on dgw/sopel-deepl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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