Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Latest commit

 

History

History
44 lines (36 loc) · 1.27 KB

README.md

File metadata and controls

44 lines (36 loc) · 1.27 KB

DeepLAPI(unofficial)

DeepL is a translation service similar to Google Translate. DeepAPI is a Swift open-source library that implements Swift-based clients to interact with the DeepL API using an Authentication Key. You can get an Authentication Key on their website. As of right now, this library supports only the free version of the API

Installation

The library requires macOS 10.16+ / iOS 14.0+ / tvOS 14.0+ / watchOS 7.0+

You can add DeepLAPI-Swift by adding it as a Swift Package Manager dependency:

  1. From the File menu, select Add packages
  2. Enter "[https://github.com/hoyelam/DeepL-Swift]"
  3. Select the package

Using Package.swift?

dependencies: [
    .package(url: "https://github.com/hoyelam/DeepL-Swift")
]

Example

To translate a text

let authToken = "12345QWERTASDFG" // Provided by DeepL
let service = DeepLAPI(authToken: authToken)
let request = TranslationRequest(
    text: "Hello World!",
    sourceLanguage: .english,
    targetLanguage: .dutch
)

do {
    let result = try await service.translateText(request: request)
    print(result.translations)
} catch let error {
    // Your amazing error handling
}

To be supported

  • DeepL Pro
  • Managing Glossaries
  • Translating Documents