Translate mixed languages to single language - google-translate

I would like to allow users to view a list of mixed-language comments (ie ten in English and four in Spanish) in their preferred language. I am only able to get Google Translate to translate the list to Spanish. How do I use Google Translate to translate the Spanish inputs to English? When I select "English" it just shows me the original mixed inputs.

My mistake. I reverted to W3C example code and it worked as I had intended.

Related

How to get romanization of word using google translate API (word is translated in different language but get its pronunciation form in english )

I am trying to get translation of words using https://cloud.google.com/translate/docs/setup API
It all works fine but I need to get the translated word in english(romanized)
For eg: If input word in english is hello & translated to Japanese returns こんにちは
But I need this translated in english Kon'nichiwa (like the way google translate website shows it)
Using the google translate API, it just returns the translated word in the corresponding language.
Is there anyway to achieve this ?
I am open to use any other API as well (as long as it has some free version of it)

How to get roman hindi from google translate api?

While using google translate api for english to hindi translation, we are trying to fetch translated roman hindi for an english search query, searching for suitable method.
Currently, the transliteration from English en to Hindi hi, which means that the result will the translated text with only Latin characters, is not supported. As per the comments, from English shoes the expected output would be joote. However, the output is जूते.
There is an already open Feature request within Google's Issue tracker, here, addressing the Transliteration for the Cloud Translation API. Thus, you can click on the +1 button and leave a comment so the Googlers know this issue is also relevant to you. Lastly, I should point out that this platform is used to track bugs and feature requests made by the costumers.

wrong language detection with google translate (multiple languages)

I am currently working on something where I am trying to translate a paragraph which includes more than one language.
Now I have realised with the google translate API if we have lets say:
hello bye hola
it will detect the language as English and if its:
hello hola adios then it will detect Spanish.
So basically whichever language has the highest word count in the sentence/paragraph, it will detect that language. Now the funny thing is that on google translate they actually have this feature.
Is there any way that to fix this issue so that it will only detect the foreign language and not English?
No, there's not a way to do that with the Google Translate API because there's just no mechanism for that exposed in their public API.
If you use an alternate language detection library, you can define a threshold under which to remove the content of the less-represented language. This would allow you to remove the English content if it makes up less than, say, 30% of the text in your overall sample.
For example, see the RemoveMinorityScriptsTextFilterTest class in the optimaize/language-detector project.

How to retrieve a content from FreeBase.com in Italian language?

How to retrieve a content from FreeBase.com in Italian language?
Now, I can only see content from eng.wikipedia.org.
A lot of the information in Freebase is language independent, but if you want Italian language strings, you can get them by specify that it your queries (the default is English if no language is specified). There's an example app here
For things which are sourced from Wikipedia, the English language Wikipedia forms the basis, so if something only exists in the Italian Wikipedia, it won't be included. For things which are in both, you can get links to both the English article and the Italian article (and you can't get the Italian name directly from Wikipedia or look things up by it).
I don't know how you are making the call, but add this parameter to it:
lang=/lang/it

Translating external api results in Drupal

We're building a multi-language Drupal stack and one of the concerns we have is that our payment processor is going to have to send back some information to us. We've been able to narrow this down so that the strings they're sending back look like
<country code>-<number of months>
so we can easily translate that into any number of languages, except English.
t('FR-12') is all well and good if we want to translate that into a french description, but because there's not an English language a similar string like t('EN-12') is not translatable.
Similarly for the generic string: #API_Connection_Error
This sort of generic string approach seemed really compelling to me at first but it seems to not work in Drupal. Do you have any suggestions about how to translate generic strings like this into both English and other languages?
Thank you, I've been looking through Google all morning.
I see two ways to achieve this at the moment:
You could just replace the default English language definition with a custom version. That way, you can 'translate' selected English strings just as with any other language. If you have configured locale module to fallback to the original string in case of absent translations, you can just add your special cases as translations to your custom English version, and everything else will use the original English version.
Take a look at the String Overrides module - it allows you to define custom overrides for any string that gets passed through t(), with separate overrides per language, including the original English.
I'd use the second option in your case, except if the number of 'external' strings is very high. See the first if clause of the t() function for the mechanism used for the overrides (lookup in language specific Drupal variable arrays).
Note that the String Overrides module just adds admin UI pages to configure those Drupal variables in the Backend - you could add/adjust them yourself as well (e.g. from a custom module).

Resources