我已经成功地将“乌尔都语英语文本”转换为乌尔都语文本,但是在尝试另一种方法时遇到了问题。例如,这段代码运行良好,并且得到了正确的响应
googleTransliterate.transliterate('mujy ghar kharedna hai lekin mery pass paisy nahe hain', 'en', 'ur', function(err, transliteration){
console.log(transliteration)
});
但是尝试urdu转换为“英语中的urdu”时出现错误
googleTransliterate.transliterate('مجے گھر خریدنا ہے لیکن میرے پاسس پیسے نہی ہیں', 'ur', 'en', function(err, transliteration){
console.log(transliteration)
console.log(err)
});
错误
Error: Could not fetch url https://www.google.com/transliterate?langpair=ur|en&text=%D9%85%D8%AC%DB%92%20%DA%AF%DA%BE%D8%B1%20%D8%AE%D8%B1%DB%8C%D8%AF%D9%86%D8%A7%20%DB%81%DB%92%20%D9%84%DB%8C%DA%A9%D9%86%20%D9%85%DB%8C%D8%B1%DB%92%20%D9%BE%D8%A7%D8%B3%D8%B3%20%D9%BE%DB%8C%D8%B3%DB%92%20%D9%86%DB%81%DB%8C%20%DB%81%DB%8C%DA%BA, with status 404. Got error: null.
at Request._callback (C:\Users\HOME\Documents\google transilerate\node_modules\jsonp-client\lib\jsonp-node.js:81:13)
at Request.self.callback (C:\Users\HOME\Documents\google transilerate\node_modules\request\request.js:121:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (C:\Users\HOME\Documents\google transilerate\node_modules\request\request.js:985:14)
at emitOne (events.js:121:20)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (C:\Users\HOME\Documents\google transilerate\node_modules\request\request.js:936:12)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)