Skip to content

Commit e9445b8

Browse files
Anwesha NaskarAnwesha Naskar
Anwesha Naskar
authored and
Anwesha Naskar
committed
Fixes watson-developer-cloud#318 by changing language-translator url to default to language-translator
1 parent 144a709 commit e9445b8

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ Translate text from one language to another or idenfity a language using the [La
339339

340340
**Note:** There is a deprecated Language *Translation* service and a newer Language *Translator* service. The only difference is the pricing structure and the service endpoint.
341341

342-
The SDK currently defaults to the older endpoint for both `LanguageTranslationV2` and `LanguageTranslatorV2`, but `LanguageTranslatorV2`'s default endpoint will change in the next major release (3.0.0). **To guarantee compatibility, include the `url` when creating a `LanguageTranslatorV2` instance.**
343-
344342
See [Migrating from Language Translation][language-translator-migration] for more details.
345343

346344
```javascript

language-translator/v2.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,18 @@ const BaseService = require('../lib/base_service');
2626

2727
/**
2828
*
29-
* @param {string} [params.url=https://gateway.watsonplatform.net/language-translation/api] The service URL.
29+
* @param {string} [params.url=https://gateway.watsonplatform.net/language-translator/api] The service URL.
3030
* @param {string} params.username Username
3131
* @param {string} params.password Password
3232
* @constructor
3333
*/
3434
function LanguageTranslatorV2(options) {
35-
// Welp, this is awkward. Originally the rename was *just* a rename, but then (after the SDK was updated,
36-
// but before the backend was updated), it was decided that the billing should be simplified at the same time.
37-
// That's a solid improvement, but it means that the SDK now needs to support both services independently,
38-
// and correcting the default URL here will break older code, so it must be reserved for a major release.
39-
// todo: consider checking for options.url === LanguageTranslationV2.URL and also throw this warning then.
40-
// (This probably does't matter since the api didn't change)
41-
if (!options || !options.url) {
42-
const err = new Error(
43-
'LanguageTranslatorV2 currently defaults to the url for LanguageTranslationV2, ' +
44-
'but this will change in the next major release of the watson-developer-cloud Node.js SDK. ' +
45-
'Please either specify the url https://gateway.watsonplatform.net/language-translator/api or else use ' +
46-
'LanguageTranslationV2. ' +
47-
'See http://www.ibm.com/watson/developercloud/doc/language-translator/migrating.shtml for more details.'
48-
);
49-
// eslint-disable-next-line no-console
50-
console.warn(err);
51-
}
52-
5335
BaseService.call(this, options);
5436
}
5537
util.inherits(LanguageTranslatorV2, BaseService);
5638
LanguageTranslatorV2.prototype.name = 'language_translator';
5739
LanguageTranslatorV2.prototype.version = 'v2';
58-
LanguageTranslatorV2.URL = 'https://gateway.watsonplatform.net/language-translation/api'; // This is incorrect and will change in v 3.0.0
40+
LanguageTranslatorV2.URL = 'https://gateway.watsonplatform.net/language-translator/api';
5941
/**
6042
* Return the translation models
6143
*/

0 commit comments

Comments
 (0)