<commit_before>Polyglot
========

Swift wrapper around Microsoft Translate API. By default, it translates to English from whatever language is detected.

## Basic Usage

Create a new ```Polyglot``` instance.
```swift
let translator = Polyglot(clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET")
```

You can optionally specify to & from language codes.
```swift
translator.fromLanguage = "nl" // It will automatically detect the language if you don't set this.
translator.toLanguage = "en" // English. This is the default.
```

Start translating.
```swift
let dutch = "Ik weet het niet."
translator.translate(dutch) { translation in
   println(String(format: "\"%@\" means \"%@\"", dutch, translation))
}
```

Check out the [sample project](https://github.com/ayanonagon/Polyglot/tree/master/PolyglotSample) for a quick demo.

## Setting up an account for Microsoft Translate

1. Subscribe to the Microsoft Translate service [here](https://datamarket.azure.com/dataset/bing/microsofttranslator). You'll probably need to set up a new account first. Good luck. :trollface:
2. Create a new application [here](https://datamarket.azure.com/developer/applications). This is where you will be given a client ID and client secret (which you will need for using Polyglot).

## Dependencies

Because Microsoft's Translate API returns XML, Polyglot depends on [Ono](https://github.com/mattt/Ono). You should add it to your project however you like ([CocoaPods](http://cocoapods.org/) is recommended), and add it to your target's [bridging header](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html). When CocoaPods fully supports Swift, this process will become a lot simpler. :octocat:<commit_msg>[README.md] Use more elegant string formatting<commit_after>Polyglot
========

Swift wrapper around Microsoft Translate API. By default, it translates to English from whatever language is detected.

## Basic Usage

Create a new ```Polyglot``` instance.
```swift
let translator = Polyglot(clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET")
```

You can optionally specify to & from language codes.
```swift
translator.fromLanguage = "nl" // It will automatically detect the language if you don't set this.
translator.toLanguage = "en" // English. This is the default.
```

Start translating.
```swift
let dutch = "Ik weet het niet."
translator.translate(dutch) { translation in
    println("\"\(dutch)\" means \"\(translation)\"")
}
```

Check out the [sample project](https://github.com/ayanonagon/Polyglot/tree/master/PolyglotSample) for a quick demo.

## Setting up an account for Microsoft Translate

1. Subscribe to the Microsoft Translate service [here](https://datamarket.azure.com/dataset/bing/microsofttranslator). You'll probably need to set up a new account first. Good luck. :trollface:
2. Create a new application [here](https://datamarket.azure.com/developer/applications). This is where you will be given a client ID and client secret (which you will need for using Polyglot).

## Dependencies

Because Microsoft's Translate API returns XML, Polyglot depends on [Ono](https://github.com/mattt/Ono). You should add it to your project however you like ([CocoaPods](http://cocoapods.org/) is recommended), and add it to your target's [bridging header](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html). When CocoaPods fully supports Swift, this process will become a lot simpler. :octocat:
{'fraction_non_alphanumeric': 0.11393119007332206, 'fraction_numerical': 0.0011280315848843769, 'mean_word_length': 5.063247863247863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2415923', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1000, 'n_words': 373}