Add automatic translation suggestions using Google AJAX Language API
jpoesen - March 23, 2008 - 10:07
| Project: | Localization client |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I thought it would be nice and helpful addition if we could integrate automatic translation suggestions through the Google AJAX Language API.
The work is pretty much done and feedback would be appreciated. If all this passes scrutiny, I'll port to D6.
- added admin configuration area to allow enabling/disabling if translation suggestions
- extended the jQuery code to fetch a translation
- added current locale setting to the Drupal.settings js object
- added boolean of whether or not to use translation suggestions to the Drupal.settings js object
- added a button to copy the suggested translation to the translation textarea
- made minor changes to the html of the "source" area to allow that either source or translation suggestion is copied to the translation textarea
- made minor UI change (html) to separate source text from suggested translation
- made minor css change to separate source text from suggested translation
- made minor css change so .toggle area highlights on hover
- fixed #237702: Language name not shown in "Translate to" header

#1
Correction: previous supplied patches were created against 5.x-1.0. New patches applied against 5.x-1.x-dev
#2
Hm, sounds quite interesting. Some questions / suggestions:
- How would this look on the UI?
- I'd add more descriptions on what the Google Language API usage means (ie. what is shared with Google, comment about the accuracy of their service, etc).
- I am on the fence of whether this should be on or off by default.
#3
Also, please combine patches into one, it is much easier to review. Thanks!
#4
The UI change is part of the patch already. See attachment.
1. When clicking a string in the left column, the translation is automatically added to the source text you get in the middle column. The two are clearly separated by a blue line and the locale preceeds the translation:
Submit
------------------
NL: Verzend
2. an extra button 'copy translation' is added to the 3rd column. To avoid conflict with the 'copy source' button, I've wrapped source content and translation suggestion in a unique div to ensure only source or translation is copied to the textarea
About more comments on the Google api itself (privacy, accuracy, etc): where should this be put? Help? Description on the settings form?
Also, I've extracted the code and put it into a proper module (Google AJAX Language API: http://drupal.org/project/glangapi), but I've yet to release a first version. Would you like the client to depend on that module or is it ok for you like this?
Ok, I'll combine the patches.
#5
It might be better to depend on that extra module and automatically turn on this feature in our module if that module is already in place. That would be an optional dependency. In which case we can forget about the settings page.
I imagined disclaimers on the settings page where the user choose to use the Google AJAX Language API, but this only makes sense of course of we handle all in this module.
#6
Ok to let the client depend on the extra module, but I can imagine that an admin would like to be able to have the translation suggestions enabled site wide (setting in glangapi), while being able to disable it specifically for the client.
I'm thinking of a simple plugin system for glangapi where one or more additional modules would provide integration with (and a settings interface for) modules like the localization client.
If we want to enable translations this way, we'd have to look at slight modifications to the client so that I can easily extend the UI...
#7
Good! This way of the integration sounds much better :)
#8
hi
you wrote:
"If all this passes scrutiny, I'll port to D6."
i found this feature great for d5.
is the port to d6 still on the todo-list?