This project is read-only.

High translated character count using Google Translate

Jun 4, 2013 at 3:14 AM
Edited Jun 4, 2013 at 3:49 AM
When running Google Auto Translate, the previous requests is not being cleared. Which is causing already translated text to be re-translated. The issue seems to be in AutoTranslateForm.cs when the text is packed into blocks in method translateArray @ line 773.
This bug has a compounding effect in which are project containing 36,072 characters is able to hit the 2 million character daily limit in about 15 minutes.

Request 1
{ "data": { "translations": [ { "translatedText": "Old MacDonald" } ] } }

Request 2
{ "data": { "translations": [ { "translatedText": "Old MacDonald" }, { "translatedText": "aveva una fattoria" } ] } }

Request 3
{ "data": { "translations": [ { "translatedText": "Old MacDonald" }, { "translatedText": "aveva una fattoria" }, { "translatedText": "EE I EE I O" } ] } }

The source does not compile, as is. Otherwise I would have a more detailed explanation of the bug.
Jun 5, 2013 at 3:12 PM
Doing more digging yesterday, and came up with a solution.

Looking at AutoTranslateForm.cs in method translateArray @line 800, just under the "foreach (DataRow row in table.Rows)", adding items.Clear() solves the multiple translations completely. I was unable to compile the source so ended up using a disassembler to patch the IL.

Using a dissassembler, open ZetaResourceEditor.exe(version and drill down to ZetaResourceEditor.UI.Translation.AutoTranslateForm.translateArray method.
At offset 45 & 46 you should see
45: stloc.1
46: ldloc.1

Insert 3 new instructions between offset 45 & 46, the IL should end up like

45: stloc.1
46: ldloc.0
47: castclass -> System.Collections.IList
52: callvirt -> System.Void System.Collections.IList::Clear()
57: ldloc.1

This pushes the local variable(items) on to the evaluation stack, casts the variable as a generic IList then calls the Clear() method.
The C# code would look like ((IList)items).Clear();
Jun 5, 2013 at 6:45 PM
Any reason why you disassemble the app instead of simply downloading the sources and recompiling them?
Jun 5, 2013 at 7:20 PM
Edited Jun 5, 2013 at 7:21 PM
The source code from codeplex does not compile. Also a DevExpress and a Aspose licenses are required, along with missing app.config files and resource file errors. I would have gladly built from source if it was possible.

Thank you for this project, it has saved me tons of time and frustration. This was the first issue I've come across.
Jun 6, 2013 at 6:32 AM
Would it help if I update the sources to be really compilable?
Jun 6, 2013 at 2:30 PM
Absolutely! The community that has built up around Zeta-Resource-Editor would be more engaged in the project development and extremely grateful,
Jun 7, 2013 at 7:51 AM