or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/googletrans@4.0.x
tile.json

tessl/pypi-googletrans

tessl install tessl/pypi-googletrans@4.0.0

An unofficial Google Translate API for Python providing free text translation and language detection capabilities

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

99%

task.mdevals/scenario-1/

Translation Context Manager

Build a simple translation service that properly manages resources when translating text between languages.

Requirements

Your service should:

  1. Create a function that translates a single text from one language to another
  2. Ensure that network connections are properly managed and cleaned up after use
  3. Return the translated text as a string

The function should accept:

  • text: The text to translate
  • source_lang: The source language code (e.g., "en", "ko", "ja")
  • dest_lang: The destination language code

Test Cases

  • Translating "Hello" from English ("en") to Korean ("ko") returns "안녕하세요" @test
  • Translating "Good morning" from English ("en") to Japanese ("ja") returns "おはようございます" @test
  • Network connections are properly closed after translation completes @test

Implementation

@generates

API

async def translate_text(text: str, source_lang: str, dest_lang: str) -> str:
    """
    Translates text from source language to destination language.

    Args:
        text: The text to translate
        source_lang: Source language code (e.g., "en", "ko", "ja")
        dest_lang: Destination language code

    Returns:
        The translated text as a string
    """
    pass

Dependencies { .dependencies }

googletrans { .dependency }

Provides translation capabilities.

@satisfied-by