SubtitleEdit / subtitleedit

the subtitle editor :)
http://www.nikse.dk/SubtitleEdit/Help
GNU General Public License v3.0
8.57k stars 895 forks source link

Could Baidu Translation be added to auto translation drop list? #1915

Closed pendave closed 2 years ago

pendave commented 8 years ago

As you know google services are all forbidden by Chinese Gov, so we have to use proxy settings if we want to use Google Translation.

Could you please add Baidu Translation toolset?

http://fanyi.baidu.com/

Thanks a lot!

niksedk commented 8 years ago

Gave it a quick try - could you try to unpack this file to your "plugins" folder and see what happens? https://github.com/SubtitleEdit/plugins/releases/download/v.1.1/BaiduTranslate.zip

pendave commented 8 years ago

I test this plugin but it does not work

{"error":8,"msg":"ARG_NULL"}

o ksu5 dcqyze5_w6s4l 9

I don't know if this API free but here something mentioned about charge.

http://api.fanyi.baidu.com/api/trans/product/apidoc

http://api.fanyi.baidu.com/api/trans/product/apihelp

4, How much is Baidu translate open API cost? Since December 7, 2015, Baidu translate opened cloud platform officially and started deduction. If the month character translation amount is less than or equal to 2 million then that month is free; if more than 2 million characters, according to 49 yuan / million characters, the number of characters all pay the translation costs

pendave commented 8 years ago

If Baidu translate is not free to use, maybe Youdao translate could be working:

http://fanyi.youdao.com

http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule&smartresult=ugc&sessionFrom=null

niksedk commented 8 years ago

@pendave: You can toggle the log by pressing "F1"... what does it say? Do you know C# coding?

pendave commented 8 years ago

Log says:

Input to Baidu: ie=utf-8&source=txt&query=floating in space that is luminous. And%0Anow we can actually see that in the&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=differences between the specular and the%0Areflection. A specular is a fake of the&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=of the specular%2C even though in some%0Acases%2C there will be issues that will&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=reflected light of a actual light object%0Ain the scene%2C and we can control the width&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=arise. If we're using an area light or%0Ajust an environment%2C then we would want to&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=use a reflection to get that to show up on%0Aour object. And in this case%2C we have the&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=so that we can see it reflected%0Ain the object.&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Input to Baidu: ie=utf-8&source=txt&query=area light set to show in reflection%2C%0Awhich is adding that plane into the scene%2C&t=1471889368713&token=b1067b2fc50ed1ef7813c4547f26f482&from=en&to=zh Result from Baidu: {"error":8,"msg":"ARG_NULL"}

Sorry I have no knowledge of C# coding but python.

I find that API key is needed:

https://www.91yun.org/zh/archives/66

http://www.okbase.net/doc/details/484625

pendave commented 7 years ago

@niksedk I got some python codes using the test API key and it works well in DOS Command line.

http://www.bathome.net/viewthread.php?tid=44021&pid=200098&page=1&extra=page%3D1#pid200098

Can you fix this BaiduTranslate.dll plugin with the key? Thanks, hope for the update.

appid     = '20151113000005349'      #【测试用的 appid】
secretKey = 'osubCEzlGjzvw8qdQc41'   #【测试用的 secretKey】
niksedk commented 7 years ago

@pendave: thx for the info :) I've made two different methods for translating in latest plugin (v0.4) - see combo box next to "powered by Baidu". First one is the api from your comments (adapted code from www.okbase.net) and the second one is the same api as the web page uses. (it's available from SE via File -> Plugins)

How does it work?

pendave commented 7 years ago

@niksedk Thanks it works well. Baidu translation is another selection now. I prefer to use Google translation plugin as the result is much better, though guys from China have to set PROXY to cross the Great Fire Wall of China. _2j8 zdaw 1149vvf1 lt m

I also write some Python code for translating srt files using Google, Baidu and Youdao. lxtq8 uut4s6 _kb a

Even could I use BATCH mode. 5z 8xs2 _ vcj ttzm2ju

default googlesrt

The translated result is the same as what done through Subtitle Edit. Google is outstanding almost!

BTW the v2 is not working. 5gsbhmy b188roq7i6 r9 l

For something cool idea, could you extend the SE translation mode or function to Full context translation results for referrence as a SIDE window, there will be full context translation from Google or Baidu or Youdao, as after machine translation we have to do manual checking. Then we can contrast each line to the better context translation results beside and copy and paste what we like. The number of words limit may be a problem.

r0f bf499g7n7hbo7 pgo6g

pendave commented 7 years ago

Full context translation means the program will get rid of the index number & timeline code & \n or \r\n or replace it with blank space, to connect the whole lines of sentences. Actually the meaning is better than one line to one line translation by API.

mlq m lfzz 39g 4vyos4je vi4lei m s5_ b 7h6 3ak

pendave commented 7 years ago

Also the workable Google translation service deblocked is https://translate.google.cn/m?q= Such as: https://translate.google.cn/#auto/zh-CN/Full%20context%20translation%20means%20the%20program%20will%20get%20rid%20of%20the%20index%20number%20%26%20timeline%20code%20%26%20%5Cn%20or%20%5Cr%5Cn%20or%20replace%20it%20with%20blank%20space%2C%20to%20connect%20the%20whole%20lines%20of%20sentences.%20Actually%20the%20meaning%20is%20better%20than%20one%20line%20to%20one%20line%20translation%20by%20API.

0sa_i10s2t vr8r_e ax b

You need to add a 中国国内版Google which is working for guys from China without using PROXY.

Just use .cn instead of .com I think. :) cc cet6 f _5xu1pbzd 7 x