a script for yuemyutu's unique content method...

nikhil88

Regular Member
Joined
Jun 12, 2008
Messages
208
Reaction score
98
good day bhw members

this is a follow up to yuemyutu's method posted here

i've created a script in python to automate this and save us from the copying and pasting

first off u need to download python from
HTML:
http://www.python.org/download

next u need to add it to your dos path
info can be found here
HTML:
http://www.python.org/doc/faq/windows/

i have attached the script (translator.txt)
save it and change its extension to .py

now start up command prompt , access the destination folder, and type in
python translator.py

it'll ask you what needs to be translated
paste your content and press enter
a new file called translated.txt will be created in the same folder where you have stored translator.py with the google translation

obviously u need to touch up this content a little for possible errors.

hope this helps someone.

nikhil88
 

Attachments

this would be awsome if converted into a wordpress plugin...
 
i'm sorry i forgot to mention a few things up there

if u read the script, u'll notice this line:
data = "http://translate.google.com/translate_a/t?client=t&%s&sl=de&tl=en" % urllib.urlencode({'text':trans})

u can customize the translation by changing the 'sl=' and 'tl=' parameters
sl would be the source language and tl is the translate to language

the script i have provided follows this pattern
english ->spanish->englsih->french->german->english

u can change or add more combinations as per need

nikhil88
 
whats this method about??
is it like rewriting and article??
 
So this basically uses the google translator, so it's the same result if you translate it from the google's site?
 
yep it uses google translator...so u wont have to keep copying and pasting ur content for multiple language translations....
 
I was trying tweak the script a little bit and have it read from a text file.... but somehow it's failing

myfile = open("test.txt", "r")
text = myfile.read()
myfile.close()
print text

Any ideas how i can make that work?
 
Great job nikhil88.

This really does actually work! The grammar structure is retained very well and the cleaning up necessary is usually small.
 
abantu - I tried to make a simple old batch file to run it but no dice - it wouldn't accept the text paste into the DOS window. The instructions given by nikhil88 work so I'm happy to leave it at that at present.
 
nice script, its working great :) thanks for sharing!
 
how can you paste something in the command prompt? everytime i try it shows ^v
 
try right clicking ur mouse on the dos windows, and select paste

:P
 
nice! a great addon would be like to rewrite a folder of articles at once.
 
this works real great!!! thanks so much... sell it over at DP lol
 
thanks guys

@jadsn
u cant use the ctrl+v command in prompt
just right click and click paste

and i think the word limit for google translator is 300 at a time...not so sure about this though
 
@abantu
try this

f = open('test.txt')
for s in f:
s = s.strip("n")
print s
f.close
 
Thank you nikhil88. Nice script. keep up the good work!
 
glad to be of help.... and i got my first 'thank you's too :)
 
Back
Top