|
Hi Vasanth,
Google Translator is simply an academic demonstration of how to programmatically use Google's translation service. For professional use, please see the pricing information at this[^] Google page.
/ravi
|
|
|
|
|
Hey. It is great app, but is it possible to add option of downloading noty only translated word, but also a definition of it (from google translate)? Thanks
|
|
|
|
|
Hi Rafal,
Downloading a word's definition is outside the scope of Google Translator.
That being said, you can easily write a class that retrieves a word's definition, by using a framework I specifically created to perform tasks of this nature. See these 2 articles:
/ravi
|
|
|
|
|
All thanks Mr. Ravi you don't know how much you helped me
|
|
|
|
|
Glad you found the article helpful!
/ravi
|
|
|
|
|
Any way you could add an optional API access key along with a gnm model? Here is what is needed:
Class: Google::Cloud::Translate::Api — Documentation for google-cloud-translate (0.22.1)[^]
Using the neural machine translation model:
require "google/cloud/translate"
translate = Google::Cloud::Translate.new
translation = translate.translate "Hello world!",
to: "la", model: "nmt"
translation.to_s #=> "Salve mundi!"
translation.model #=> "nmt"
Please let me know!
Thank you,
Ilia
|
|
|
|
|
Hi Ilia, I'm afraid that's outside the scope of the article, which describes sans API-key access to the Google Translate API.
/ravi
|
|
|
|
|
Website ends up in 404.
Thus string url = string.Format ("https://translate.googleapis.com/translate_a/single?client=gtx&sl={0}&tl={1}&dt=t&q={2}", needs to be fixed.
Regards,
jung-kreidler
|
|
|
|
|
Thank you. I'll look into it.
/ravi
|
|
|
|
|
Can you provide helper class that can detect language of user input in c#?
I am able to do that using Microsoft translator api with authorization.But,I want to do it without authorization.
|
|
|
|
|
Sorry, I don't know how to do this.
/ravi
|
|
|
|
|
Hello,
When is included some symbols in the messaje, the translation fails, or do extrange things. And the problema is, these symbols are very used, specially in books or narrative text.
The symbols that I've detected, are the quotes symbol (") and the apostrofe (')
Can you fix it?
Currently, for Works with it, I have to pre prepare the string before send through your class to the translator. It Works... fine, but not perfect.
Thanks for all.
|
|
|
|
|
Sandl Okino wrote: Currently, for Works with it, I have to pre prepare the string before Thanks for the bug report, Sandl. By "prepare", do you mean HTML encode the quotes and special symbols?
/ravi
|
|
|
|
|
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.
|
|
|
|
|