OnMyCommand is a program that executes shell scripts and AppleScripts. You can build your own Contextual Menu Items or GUI applications with it. If you don't already have OnMyCommand installed be aware that it logs you out as part of the install process, so save everything first.
- Download and install OnMyCommand/OMCEdit.
- Run the OMCEdit application (in /Applications/OMC/).
- Click on 'Download Commands' in the toolbar and then 'Download.'
- Click on 'Command Library' in the toolbar.
- Choose #22 (Search google for) and click on 'Append to Command.' Then click 'Done.'
- Change the name if you want (in Command Name).
- Select 'Top Level' in the location drop-down if you don't want a sub-menu, or choose a name for the sub-menu ('In On My Command' is the default).
- Save the command.
From any language to French:
open "http://translate.google.fr/translate_t?hl=&ie=UTF-8&text="__OBJ_TEXT__"&sl=auto&tl=fr#"
open "http://translate.google.fr/translate_t?hl=&ie=UTF-8&text="__OBJ_TEXT__"&sl=auto&tl=en#"
You just need to make a new command (in OMCEdit), add the command in the command field and name it. Those can easily be change to fit the language of your choice. If you want to use a specific browser instead of your default add '-a YourBrowserName' without the quotes before the command.
Example:
open -a FireFox "http://translate.google.fr/translate_t?hl=&ie=UTF-8&text="__OBJ_TEXT__"&sl=auto&tl=en#"
[crarko adds: I tested these commands in Snow Leopard (10.6.4), and they work as described in some, but not all, applications. The current (2.2) version of OnMyCommand still has some issues with some 64-bit programs, although that seems to be an area that is being worked on. You should be able to make a Service in Automator that performs similar functions.]

