Skip to content

Commit b626d9c

Browse files
authored
Merge pull request #205 from chughts/translator
Translator Nodes
2 parents 4cba851 + f50b669 commit b626d9c

File tree

16 files changed

+1617
-24
lines changed

16 files changed

+1617
-24
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Node-RED Watson Nodes for IBM Bluemix
77

88
<a href="https://cla-assistant.io/watson-developer-cloud/node-red-node-watson"><img src="https://cla-assistant.io/readme/badge/watson-developer-cloud/node-red-node-watson" alt="CLA assistant" /></a>
99

10+
11+
### New in version 0.4.21
12+
- Added Translation and Language Identify nodes for Language Translator Service (Blue Tiles)
13+
- Deprecated Translation and Language Indentification nodes for Language Translation (Green Tiles)
14+
1015
### New in version 0.4.20
1116
- Translation Node supports German
1217

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-watson",
3-
"version": "0.4.20",
3+
"version": "0.4.21",
44
"description": "A collection of Node-RED nodes for IBM Watson services",
55
"dependencies": {
66
"alchemy-api": "^1.3.0",
@@ -11,7 +11,7 @@
1111
"temp": "^0.8.3",
1212
"qs": "6.x",
1313
"image-type": "^2.0.2",
14-
"watson-developer-cloud": "^2.1.0",
14+
"watson-developer-cloud": "^2.4.6",
1515
"kuromoji": "^0.0.5",
1616
"is-docx": "^0.0.3"
1717
},
@@ -37,7 +37,9 @@
3737
"watson-document-conversion-v1": "services/document_conversion/v1.js",
3838
"watson-concept-insights-v2": "services/concept_insights/v2.js",
3939
"watson-dialog-v1": "services/dialog/v1.js",
40-
"alchemy_language-v1": "services/alchemy_language/v1.js",
40+
"watson-language-translator-v2": "services/language_translator/v2.js",
41+
"watson-language-translator-identify-v2": "services/language_translator_identify/v2.js",
42+
"watson-language-translator-util-v2": "services/language_translator_util/v2.js",
4143
"watson-language-identification-v1": "/services/language_identification/v1.js",
4244
"watson-language-translate-v1": "services/language_translation/v2.js",
4345
"watson-language-translate-util-v1": "services/language_translation_util/v2.js",
@@ -54,7 +56,8 @@
5456
"watson-visual-recognition-v1": "services/visual_recognition/v1.js",
5557
"watson-visual-recognition-v3": "services/visual_recognition/v3.js",
5658
"watson-similarity-search-v3": "services/similarity_search/v3.js",
57-
"alchemy-vision-v1": "services/alchemy_vision/v1.js"
59+
"alchemy-vision-v1": "services/alchemy_vision/v1.js",
60+
"alchemy_language-v1": "services/alchemy_language/v1.js"
5861
}
5962
}
6063
}

services/language_identification/v1.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
</script>
3636

3737
<script type="text/x-red" data-help-name="watson-language-identification">
38+
<p><b>NB:</b> The Watson Language Translation service has been deprecated in favor of the new Watson Translator service. Once the service
39+
has been switched off this node will no longer work. The node will be removed from the palette in a
40+
future release. </p>
41+
<br/>
3842
<p>The Language Identification service analyzes UTF-8 encoded text, detects the language used in that text, and displays the associated 5-letter ISO language code. </p>
3943
<p>The text to detect should be passed in on <code>msg.payload</code>.</p>
4044
<p>The ISO language code will be returned on <code>msg.lang</code>.</p>
@@ -45,7 +49,7 @@
4549
<script type="text/javascript">
4650
(function() {
4751
RED.nodes.registerType('watson-language-identification', {
48-
category: 'IBM Watson',
52+
category: 'Watson Deprecated',
4953
defaults: {
5054
name: {value: ""}
5155
},

services/language_translation/v2.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@
127127
</script>
128128

129129
<script type="text/x-red" data-help-name="watson-translate">
130-
<p>Packaged in with release 0.4.19 of node-red-node-watson</p>
130+
<p><b>NB:</b> The Watson Language Translation service has been deprecated in favor of the new Watson Translator service. Once the service
131+
has been switched off this node will no longer work. The node will be removed from the palette in a
132+
future release. </p>
133+
<br/>
134+
<p>Packaged in with release 0.4.21 of node-red-node-watson</p>
131135
<p>The Language Translation service enables you to translate text from one language to another and to add your own translation models.</p>
132136
<p></p>
133137
<p><b>Translation Mode</b>.</p>
@@ -653,7 +657,7 @@
653657
// Define and run the function to register this node.
654658
(function() {
655659
RED.nodes.registerType('watson-translate', {
656-
category: 'IBM Watson',
660+
category: 'Watson Deprecated',
657661
defaults: {
658662
name: {value: ''},
659663
action: {value: 'translate'},

services/language_translation/v2.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,12 @@ module.exports = function (RED) {
5050

5151
// API used by widget to fetch available models
5252
RED.httpAdmin.get('/watson-translate/models', function (req, res) {
53-
var lt = null;
54-
55-
if(!username && !password) {
56-
lt = watson.language_translator({
57-
username: req.query.un,
58-
password: req.query.pwd,
59-
version: 'v2'
60-
});
61-
} else {
62-
lt = watson.language_translator({
63-
username: username,
64-
password: password,
53+
var lt = watson.language_translator({
54+
username: sUsername ? sUsername : req.query.un,
55+
password: sPassword ? sPassword : req.query.pwd,
6556
version: 'v2'
6657
});
67-
}
58+
6859
lt.getModels({}, function (err, models) {
6960
if (err) {
7061
res.json(err);

services/language_translation_util/v2.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
-->
1616

17-
<script type="text/x-red" data-template-name="watson-translate-util">
17+
<script type="text/x-red" data-template-name="watson-translator-util">
1818
<div id="credentials-check" class="form-row">
1919
<div class="form-tips">
2020
<i class="fa fa-question-circle"></i><b> Please wait: </b> Checking for bound service credentials...
@@ -35,7 +35,12 @@
3535
</script>
3636

3737
<script type="text/x-red" data-help-name="watson-translate-util">
38-
<p>The Language Translation Utility service enables you to discover parameters used by the language translation node.</p>
38+
<p><b>NB:</b> The Watson Language Translator service has been deprecated in favor of the new Watson Translator service. Once the service
39+
has been switched off this node will no longer work. The node will be removed from the palette in a
40+
future release. </p>
41+
<br/>
42+
<p>The Language Translation Utility service enables you to set using dasboard utility functions
43+
the language translation to be used by the Language Translation Node.</p>
3944
<p></p>
4045
<p><b>Translation Mode Utility</b>.</p>
4146
<p>The regular Watson Translation cerdentials should be set through the UI.</p>
@@ -55,7 +60,7 @@
5560
<script type="text/javascript">
5661
(function() {
5762
RED.nodes.registerType('watson-translate-util', {
58-
category: 'IBM Watson',
63+
category: 'Watson Deprecated',
5964
defaults: {
6065
name: {value: ""}
6166
},

services/language_translation_util/v2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ module.exports = function (RED) {
219219
password: {type:'password'}
220220
}
221221
});
222-
};
222+
};
1.16 KB
Loading

0 commit comments

Comments
 (0)