flyerhzm/chinese_permalink — pull request #3 by chitsaou (2012-07-31 03:03:57+00:00)
Title: Transition to Microsoft Translator on Azure Marketplace

Microsoft Translator is now available on Azure Marketplace, and the original [Translator Developer Page](http://www.microsofttranslator.com/dev/) also promotes the new Azure Marketplace application, although the old API is still working (which chinese_permalink gem uses today.)

The new API from Marketplace must be authorized via OAuth, and an access_token will be expired in a certain time, thus the library must take care about re-authorization. I found a gem `bing_translator` CodeBlock/bing_translator-gem that can deal with authorization and take care about expired access_token.

The biggest difference is that config file `config/chinese_permalink.yml` must be modified because it needs client ID and client secret for authorization. Currently there is only AppID required, which is no longer required either. Example:

```yaml
bing:
client_id: XXXXXXXXXX
client_secret: XXXXXXXXXX
language: zh-cht # from which language
```

p.s. I can't even run `rake test` in current version, so I'm not sure if these changes pass unit tests, but it's been tested with one of our products and seems working.