README.md in translator-text-0.2.0 vs README.md in translator-text-0.3.0
- old
+ new
@@ -27,19 +27,38 @@
* Once logged on your [Azure portal](https://portal.azure.com/), subscribe to the Translator Text API in Microsoft Cognitive Service.
* You will find two subscription keys available in 'RESOURCE MANAGEMENT > Keys' ('KEY 1' and 'KEY 2').
## Usage
-### Translation
+### Client
+You can instanciate your own client by passing the [Azure authentication](https://learn.microsoft.com/en-us/azure/ai-services/translator/reference/v3-0-reference#authentication) parameters.
+
```ruby
require 'translator-text'
-api_key = ENV.fetch('COGNITIVE_SUBSCRIPTION_KEY')
-client = TranslatorText::Client.new(api_key)
+client = TranslatorText::Client.new(api_key, api_region)
+```
-results = client.translate(
+Or use the built-in that uses the following environment variables:
+
+* `COGNITIVE_SUBSCRIPTION_KEY`: The value is the Azure secret key for your subscription to Translator.
+* `COGNITIVE_SUBSCRIPTION_REGION`: The value is the region of the multi-service or regional translator resource. This value is optional when using a global translator resource.
+
+```ruby
+require 'translator-text'
+
+client = TranslatorText.client
+```
+
+
+### Translation
+
+```ruby
+require 'translator-text'
+
+results = TranslatorText.client.translate(
['something to translate', 'another something to translate'],
to: [:fr, :es]
)
# Returns
@@ -56,13 +75,10 @@
### Detection
```ruby
require 'translator-text'
-api_key = ENV.fetch('COGNITIVE_SUBSCRIPTION_KEY')
-client = TranslatorText::Client.new(api_key)
-
-results = client.detect(['some unknown language', 'quelque chose à détecter'])
+results = TranslatorText.client.detect(['some unknown language', 'quelque chose à détecter'])
# Returns
# [
# #<DetectionResult language=:en score=1.0 isTranslationSupported=true isTransliterationSupported=false alternatives=[
# #<Alternative language=:de score=1.0 isTranslationSupported=true isTransliterationSupported=false>,