()
| 31 | // a single piece of text, or an array of strings for detecting the languages |
| 32 | // of multiple texts. |
| 33 | async function detectLanguage() { |
| 34 | let [detections] = await translate.detect(text); |
| 35 | detections = Array.isArray(detections) ? detections : [detections]; |
| 36 | console.log('Detections:'); |
| 37 | detections.forEach(detection => { |
| 38 | console.log(`${detection.input} => ${detection.language}`); |
| 39 | }); |
| 40 | } |
| 41 | |
| 42 | detectLanguage(); |
| 43 | // [END translate_detect_language] |
no outgoing calls
no test coverage detected