()
| 134 | setTranslation(null); |
| 135 | |
| 136 | const fetch = async () => { |
| 137 | try { |
| 138 | const input = text.split("\n").join(" ").trim(); |
| 139 | const results = await translate([input]); |
| 140 | if (!cancelled && results[0]) { |
| 141 | setTranslation(results[0]); |
| 142 | } |
| 143 | } catch (err) { |
| 144 | console.error("Translation error:", err); |
| 145 | } |
| 146 | }; |
| 147 | |
| 148 | fetch(); |
| 149 | return () => { |
no test coverage detected