Description:
This plugin allows players to translate text on the chat without even leaving their favorite game server. It's dedicated to people who are not confident with foreign languages, who don't want to lose time into translation to communicate or those who just want to have fun with foreign friends.
Features:
- translates text from and to any language supported by Google Translate.
- automatic chat translation. If a chat line is detected to be written in a "foreign" language, the text is translated and dislplayed.
Commands:
- !trans [src lang|dest lang] <sentence> : translates a sentence (use @trans to make the translation available to everyone).
- !translast : translates the latest available sentence from the chat.
- !transauto : enables/disables automatic translation feature.
- !transversion : displays plugin version.
How to use !trans:
The source language parameter is optional and should be used if language auto-detection fails. The destination language parameter is optional, use it if you don't want to translate into the default language.
- example 1, language auto-detection, default destination language :
!trans Sentence to translate
- example 2, language auto-detection, given destination langyage :
!trans |nl Sentence to translate
- example 3, given source language, default destination language :
!trans fr| Phrase a traduire
- example 4, given source and destination languages :
!trans fr|de Phrase a traduire
Installation:
- copy the directory "xgoogle" into your b3 root directory.
- copy the file "xjson.py" into your b3 root directory (optional if you use geowelcome plugin).
- copy the file translators.py into b3/extplugins.
- copy the file translators.xml into b3/extplugins/conf.
- add the following line into the plugins section in b3.xml : <plugin name="translators" config="@b3/extplugins/conf/translators.xml"/>
Configuration file:
- settings/autotranslation : activates automatic translation at startup.
- settings/autothreshold : sets the minimum sentence size required to translate it automatically (also used by !translast).
- settings/translatecmd : if set to 1, also translates chat lines starting with a B3 command.
- settings/defaultsrclang : sets default source language (optional).
- settings/defaultdestlang : sets default destination language.
Notes:
- translations may be inaccurate, use it at your own risk.
- for a list of available languages see http://translate.google.com and http://www.google.com/cse/docs/resultsx ... untryCodes for country codes.
- special characters like accented letters or cyrillic are not displayed.
- the plugin name is Translators, with a final 's'.
- keep in mind that this plugin produces additional network traffic to get the results from Google Translate.
- the translation function can be used in other plugins. Just load the Translators plugin first :
- Code: Select all
self._translators = self.console.getPlugin('translators')
if not self._translators:
self.debug('Could not find Translators plugin')
Then use translate() method within try-except block :
- Code: Select all
try:
msg = self._translators.translate('Sentence you want to translate')
except:
pass
Same language parameters as the !trans command can be set, for example translate('|es Sentence you want to translate').
- this plugin can be used as a command-line translator. Add your B3 directory path to the PYTHONPATH shell variable, then run the plugin by typing python translators.py.
Forum thread:
http://www.bigbrotherbot.net/forums/rel ... rs-plugin/
Download link:
http://www.bigbrotherbot.net/forums/dow ... ew;down=86
Thanks:
- Google Translate : http://translate.google.com
- xgoogle python library by Peteris Krumins: http://www.catonmat.net/blog/python-lib ... translate/
- DSWP community (http://www.dswp.de) and other Urban Terror players for testing.