Log in

View Full Version : Just released: my utility for people reading 4pda.ru via Babelfish


Menneisyys
10-09-2007, 01:39 PM
4pda.ru, in addition to XDA-Developers, is one of the best sources of Windows Mobile-related hacking information. It was in there (http://4pda.ru/forum/index.php?showtopic=1333) that, for example, I’ve found the hacked, 1023 TAO Midlet Managers, on which, then, Risidoro has built on his latest (1036) TAO releases at XDA-Dev (http://forum.xda-developers.com/showthread.php?t=327456), along with a lot of other info never published in English. Myself not being a businessman traveling in Russia all around or watching / reading / listening to Russian-language literature / music / movies, I would never have thought I would find my knowledge of Russian useful in my professional life – now I have :)

Should you not know Russian, I’ve created a tool that greatly helps in reading 4pda forums. For this, you will, of course, want to use Babelfish (http://babelfish.altavista.com/) to translate these pages. Just enter the URL (in the case of the MIDlet thread, http://4pda.ru/forum/index.php?showtopic=1333 ) in the Translate a Web page text field, select “Russian to English” in the lower “Select from and to languages” drop-down list and click the bottom Translate button.

After a while, you’ll notice that not everything is displayed – after about 100 kbytes of source HTML, posts are cut and you can’t make the final part displayed in any way, as can also be seen in THIS (http://www.winmobiletech.com/092007MidletBible/4pdaruBabellfish.png) screenshot (see the “<<<<<<<< snip >>>>>>>>” at the bottom – it shows Babelfish won’t translate more).

The wrong approach you can take in these cases are as follows:
you cut and paste the text in Babelfish in the upper, direct text input field. It’s a very awkward and slow solution because you can only have some 2-3 kbytes of text translated at one time
save the original Web page to your local PC, edit its HTML source (cut out the first, say, half of the original page) and upload the edited version to any Web server so that it becomes visible to Babelfish. This also involves a lot of additional work.
Unfortunately, the print mode (clicking the “Версия для печати” link, which takes you HERE (http://4pda.ru/forum/index.php?act=Print&client=printer&f=83&t=1333) – HUGE page!) doesn’t help much. Much as it (to some degree) cleans up the code and removes the, for most quick translations, unnecessary stuff (avatars, number of posts, links to other pages, ads), it returns the article as one big file, which is, with longer threads, well above 100 kbytes. This means you won’t see most of the newer posts translated either.

The right approach, of course, is using my tools ;-). I’ve created a program that automatically downloads the contents of an entire thread, sliced to small HTML pages named following an easy-to-autogenerate-links-to naming convention. What is more, I also release the source (available HERE (http://www.winmobiletech.com/092007MidletBible/ForPDAruSimplifier.java)) for it so that you can see how it works. You’re also free to modify it to download other forum content in a much more Bablefish (and, for that matter, also PDA/ mobile) -friendly format.

Usage

if you haven’t already done so, install a Java environment on your desktop PC (free JDK download HERE (http://java.sun.com/products/j2se))
download the above-mentioned source file (http://www.winmobiletech.com/092007MidletBible/ForPDAruSimplifier.java)
enter the “javac ForPDAruSimplifier.java” command in the same directory (from inside, say, Total Commander) so that the source is compiled
enter the following command:

java ForPDAruSimplifier 30 1050 1333 "4pda-"

where the parameters are as follows:

30 is pretty much fixed for 4pda.ru (but different with other sites; this is why I’ve made it an easily modifiable parameter) – the number of posts displayed on a forum page
1050 is a product of 30 and 35. 30 is the above-introduced posts-on-a-page parameter; 35 is the number of thread pages. (Now, the MIDlet thread has 35 pages.)
1333 is the number of the thread itself; it can be very easily found. For example, the 1333 for the MIDlet thread can be very easily spotted if you take a look at the URL of the thread: http://4pda.ru/forum/index.php?showtopic=1333. Yes, it’s the number after “showtopic=”.
Finally, "4pda-" instructs the tool to save the target files with the “4pda-“ filename prefix. You can use any other prefix.


After running the tool, upload the resulting files (in this case, 4pda-01.html … 4pda-35.html) to the Web so that Babelfish can access it. You can start entering the new addresses into Babelfish. An even better an easier approach is creating a link file, where all you need to do is clicking all the link files in order, with Ctrl (IE) or Ctrl-Shift (Opera) hold down. The latter makes sure the links are opened in a background tab. Just give a try to the following links to see this for yourself: 01 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-01.html), 02 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-02.html), 03 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-03.html), 04 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-04.html), 05 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-05.html), 06 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-06.html), 07 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-07.html), 08 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-08.html), 09 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-09.html), 10 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-10.html), 11 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-11.html), 12 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-12.html), 13 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-13.html), 14 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-14.html), 15 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-15.html), 16 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-16.html), 17 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-17.html), 18 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-18.html), 19 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-19.html), 20 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-20.html), 21 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-21.html), 22 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-22.html), 23 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-23.html), 24 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-24.html), 25 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-25.html), 26 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-26.html), 27 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-27.html), 28 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-28.html), 29 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-29.html), 30 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-30.html), 31 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-31.html), 32 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-32.html), 33 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-33.html), 34 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-34.html), 35 (http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ru_en&url=http%3A%2F%2Fwww.winmobiletech.com%2F092007MidletBible%2F4pda-35.html). (Downloadable, original source of the above HTML links HERE (http://www.winmobiletech.com/092007MidletBible/English4PDARUThreads.html))

See the difference? None of the original pages were cut in half and all posts are perfectly readable.

Note that I’ve modified the code so that it doesn’t include local file attachments (my code removes the links). If you know 4pda.ru (or, most Russian PDA sites and their views about international Copyright issues), you know why I’ve chosen to do so.

Menneisyys
10-11-2007, 07:33 AM
In the meantime, I've been pointed to Google Translate. See my related remarks in the comments section of http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2229&more=1&c=1&tb=1&pb=1 - I've made quite extensive comparison between the results Google Translate and Babelfish produces when it comes to translating Russian text.