Crate dptran

source ·

Structs§

  • DeepL API usage information
    character_count: Number of characters translated this month
    character_limit: Maximum number of characters that can be translated this month
    If character_limit is 0, it is unlimited

Enums§

  • ConnectionError
    It is an error that occurs when communicating with the DeepL API.
    BadRequest: 400 Bad Request
    Forbidden: 403 Forbidden
    NotFound: 404 Not Found
    RequestEntityTooLarge: 413 Request Entity Too Large
    TooManyRequests: 429 Too Many Requests
    UnprocessableEntity: 456 Unprocessable Entity
    ServiceUnavailable: 503 Service Unavailable
    CurlError: Curl Error
    UnknownError: Unknown Error
  • DeepL API error.
    ConnectionError: Connection error occurred in the process of sending and receiving data.
    JsonError: Error occurred while parsing json.
    LimitError: The translation limit of your account has been reached. Consider upgrading your subscription.
    GetLanguageCodesError: Could not get language codes.
  • Errors that can occur in this library.
    DeeplApiError: DeepL API error
    InvalidLanguageCode: Invalid language code
    ApiKeyIsNotSet: API key is not set
    NoTargetLanguageSpecified: No target language specified
    CouldNotGetInputText: Could not get input text
  • Target / Source language types
    used in get_language_codes()

Functions§

  • Check the validity of language codes. Using DeepL API.
    api_key: DeepL API key
    lang_code: Language code to check
    lang_type: Target or Source
  • Convert to correct language code from input language code string. Using DeepL API.
    api_key: DeepL API key
    language_code: Language code to convert
  • Get language code list. Using DeepL API.
    Retrieved from https://api-free.deepl.com/v2/languages.
    api_key: DeepL API key
    lang_type: Target or Source
  • Get the number of characters remaining to be translated. Using DeepL API.
    Retrieved from https://api-free.deepl.com/v2/usage.
    Returns an error if acquisition fails.
    api_key: DeepL API key
  • Display translation results. Using DeepL API.
    Receive translation results in json format and display translation results.
    Return error if json parsing fails.
    api_key: DeepL API key
    text: Text to translate
    target_lang: Target language
    source_lang: Source language (optional)

Type Aliases§