CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-googletrans

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

Overall
score

100%

Evaluation100%

1.01x

Agent success when using this tile

Overview
Eval results
Files

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

Install with Tessl CLI

npx tessl i tessl/pypi-googletrans@4.0.0

tile.json