|
Hmmm nop,, for prepare, I mean change the conflicting simbols for a random text that google will can't translate, and keep it, and after receipt the translation, I can undo the change.
Before use this system, I tried to use the URLEncode and the HTMlEncode of system.net class (If I'm not wrong) but they don't work.
Well. if you can fix this anoying problema, I thankyou very very much. I use this lib for an automatic tool that translate the selected text on the clipboard, and well. With this bug simple lines of a book can't be translated correctly.
An example:
- Hello man! I'm your friend! - Say the Little man to the giant.
- "who is this guy? I don't know it!" - think the giant, while smiles to the Little man.
Well... the example is stupid, but google will be have problems whith the dashes, quotes and other similar simbols like / \ |. It think that these simbols are separating two diferent sentenses or part of the json,and manipulate wrongly the translation.
Well, that is all, and sorry for the late of my answer. ¡thanks for all!
|
|
|
|
|
I remember in my code i had to make several changes in the text before and after translation here is the code it may need some adaptations:
private static Dictionary<string, string=""> ReplacementsA = null;
private static Dictionary<string, string=""> ReplacementsB = null;
private static Dictionary<string, string=""> ReplacementsC = null;
// Initialize replacement arrays
private static void Init_Replacements()
{
ReplacementsA = new Dictionary<string, string="">
{
{"%", "<p0c>"},
{"&", "<c0e>"},
{";", "<p0v>"},
{"[", "<sb0l>"},
{"]", "<sb0r>"}
};
ReplacementsB = new Dictionary<string, string="">
{
{" @", "@"},
{"@ ", "@"},
{"'", "'"},
{"'", "'"},
{""", "\""},
{"& lt ;", "<"},
{"<", "<"},
{">", ">"},
{"& gt ;", ">"},
{"\u00ae", "®"},
{"%0d", "\n"},
{"%0D", "\n"},
{"%0a", "\n"},
{"☺", "\n"}, // mymemory end of line replacement
{"\\u003c", "<"},
{"\\u003e", ">"}
};
ReplacementsC = new Dictionary<string, string="">
{
{"<p0c>", "%"},
{"<p0c>", "%"},
{"<c0e>", "&"},
{"<c0e>", "&"},
{"<p0v>", ";"},
{"<p0v>", ";"},
{"<p0v>", ";"},
{"<> P0V", ";"},
{"<פּ0וו>", ";"},
{"",""},
{"",""},
{"<sb0l>","["},
{"<sb0l>","["},
{"<sb0l>","["},
{"<sb0r>","]"},
{"<sb0r>","]"},
{"<sb0r>","]"},
{" ;",";"},
{"//","/"}
};
}
public static string replace_chars_before(string storeplace)
{
return StringBuilderReplace(new StringBuilder(storeplace), ReplacementsA);
}
public static string replace_chars_after(string storeplace)
{
while (storeplace.IndexOf(" ;") != -1) storeplace = storeplace.Replace(" ;", ";");
storeplace = StringBuilderReplace(new StringBuilder(storeplace), ReplacementsB);
while (storeplace.IndexOf(" >") != -1) storeplace = storeplace.Replace(" >", ">");
while (storeplace.IndexOf("< ") != -1) storeplace = storeplace.Replace("< ", "<");
return StringBuilderReplace(new StringBuilder(storeplace), ReplacementsC);
}
|
|
|
|
|
O, thanks! thanks soo mutch! I have to try it! thanks :P
|
|
|
|
|
can it detect the language of the original speech?
|
|
|
|
|
|
|
|
Thanks for posting this.
This technique provides many opportunities to add dynamic internationalisation to web apps.
Garry Lowther
CEO and Founder
TriSys Business Software
Cambridge, England
www.trisys.co.uk
|
|
|
|
|
Thanks, Garry. Also please see this[^] comment.
/ravi
|
|
|
|
|
Nice upgrade to use AJAX.
|
|
|
|
|
Thank you for your vote!
/ravi
|
|
|
|
|
Thank you for updating and sharing. This little program is very useful in the classroom and looking forward to having it tried out.
One quick question if I may:
Having issue with the "
Microsoft.Windows.Installer.3.1 and VS2015C.
Wondering if it is possible to remove the windows installer 3.1 (or at least update)?
Please understand I am far from expert so my question may seems silly, but it is not to me
Thanks again for sharing.
|
|
|
|
|
Not sure why Windows Installer is being packaged with your VS2015 project. It's not in the original solution and doesn't show up when you open the project in VS2013 (which is what I use).
/ravi
|
|
|
|
|
VS2015C does pretty good job of converting but this is perfect example of issue that popup.
Now I know can remove without ill side effects.
Thank you for letting me know.
|
|
|
|
|
"you'd be wise to confirm the translation with a native speaker before using the results."
As someone who has worked as a translator and in the field of software localisation for a long time, I cannot stress how important it is to understand that google's translations are a last resort to help you understand a text in a language you don't speak. Using google's translation results to actually communicate with real people is a disaster waiting to happen.
Even human translators can be extremely error-prone if they don't do their job properly. One of the most important things to do when translating is to establish context - something that google translate is extremely poor at. This is particularly obvious when a word has multiple meanings, or can be both a verb and a noun. Using google translate can result in complete gobbledygook - one of my favourites being a tourism website talking about Wagner's (the composer) "factories". Obviously this makes no sense and is liable to completely flummox anyone who doesn't realise that the source language (German) was using the word for "works" in the sense of "something that a person produced" rather than "a place where goods are manufactured".
If you want the text to be understood by a human reader, and want to create a professional impression, steer clear of automatic translations. They are often only fully comprehensible to people who speak the original language - because you often have to literally back-translate the "translation" word by word to understand the actual intended meaning. If you need to be able to speak the source language to understand the translation properly, it kind of renders the translation pointless.
So yeah, it's a great tool for understanding the general gist of a website or to find the download button. Not suitable for actual production usage. And a word of advice - don't use google translate to pre-translate stuff and then send it to someone to proofread. They will hate you for it. Send the source text to someone who speaks the source language fluently and who is a native speaker of the target language. They will find it much easier to translate the text properly from scratch than fixing a poor translation.
|
|
|
|
|
I'm a great big fan of Wagner's factories. I mean works.
/ravi
modified 21-Mar-16 20:35pm.
|
|
|
|
|
|
Nice work! I've incorporated your findings into the article (and have credited you). Thanks!
/ravi
|
|
|
|
|
Great job!
|
|
|
|
|
I use that way for years, but it not work for now, as Google add a token into the URL, ie:
https://translate.google.com/translate_a/single?client=t&sl=ja&tl=en&hl=en&dt=bd&dt=ex&dt=ld
&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&srcrom=1&ssel=0&tsel=0&kc=2&tco=2&tk=910943.773956&q=love
I'm believe that this token is caculated by javascript at user computer, but I dont find out where and how it caculated!
Also as Google think about the token, find the token algorithm maybe a waste of time, because the algorithm may change in short time.
|
|
|
|
|
tk is computed in a couple of places, which may not be easy to replicate in code.
One such instance is:
var tk = new function()
{
var a=_.pc();
this.b=_.M(a,_.Nb,8) || new _.Nb},
uk=_.I(_.L(tk.b,2)),
vk=_.H(_.L(tk.b,4)),
wk=_.H(_.L(tk.b,3)),
xk=_.H(_.L(tk.b,5)),
yk,
zk=tk.b;
yk=null!=_.L(zk,1)?_.L(zk,1):1;
_.x("gbar.bv", {n:uk,r:vk,f:wk,e:xk,m:_.I(yk,1)});
_.x("gbar.kn", function() {return!0});
_.x("gbar.sb", function() {return!1});
} /ravi
|
|
|
|
|
Yes, ultil we fully extract the method Google Translate caculate token, we can not use it this way.
|
|
|
|
|
|
Nice work! I've incorporated your findings into the article (and have credited you). Thanks!
/ravi
|
|
|
|
|
|