Latest 0.1.1
Homepage https://github.com/maximbilan/SwiftGoogleTranslate
License MIT
Platforms ios 8.0, requires ARC
Authors

SwiftGoogleTranslate

Version
License
Platform
CocoaPods

A framework to use Cloud Translation API by Google in Swift.

Installation

CocoaPods:

pod 'SwiftGoogleTranslate'

Manual:

Copy SwiftGoogleTranslate.swift to your project.

Initialization

First of all you have to generate API key to use Google Cloud services in the console.
And then use the following code:

SwiftGoogleTranslate.shared.start(with: "API_KEY_HERE")

Using

The framework supports 3 endpoinds: translate, detect, languages. You can find more information in the official source. How to use from the framework.

Translation:

SwiftGoogleTranslate.shared.translate("Hello!", "es", "en") { (text, error) in
  if let t = text {
    print(t)
  }
}

Detection:

SwiftGoogleTranslate.shared.detect("¡Hola!") { (detections, error) in
  if let detections = detections {
    for detection in detections {
      print(detection.language)
      print(detection.isReliable)
      print(detection.confidence)
      print("---")
    }
  }
}

A list of languages:

SwiftGoogleTranslate.shared.languages { (languages, error) in
  if let languages = languages {
    for language in languages {
      print(language.language)
      print(language.name)
      print("---")
    }
  }
}

License

SwiftGoogleTranslate is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SwiftGoogleTranslate",
    "version": "0.1.1",
    "summary": "SwiftGoogleTranslate",
    "description": "A framework to use Cloud Translation API by Google",
    "homepage": "https://github.com/maximbilan/SwiftGoogleTranslate",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Maxim Bilan": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/maximbilan/SwiftGoogleTranslate.git",
        "tag": "0.1.1"
    },
    "source_files": [
        "Classes",
        "SwiftGoogleTranslate/SwiftGoogleTranslate/Sources/**/*.{swift}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This