Extension:Wikitrans

Wikitrans is a MediaWiki extension that enables full machine translation support for MediaWiki during editing and PHP article generation. Wikitrans converts and translates wikitext into a target language in HTML output through MediaWiki, while retaining and saving the original English text in the body of the Article. Wikitrans renders and translates the wikitext dynamically into HTML when the article is saved in the database.

Background
Wikitrans was written by Jeffrey Vernon Merkey of the Wolf Mountain Group and currently supports machine translation of English into Cherokee, Choctaw, Creek, Chickasaw, and German Languages. Wikitrans uses hierachical lexicons, phrase and morpheme construction, full language synthesis, and grammar parsing and conversion for a growing number of Native American and European Languages.

The PHP source code to integrate Wikitrans into MediaWiki 1.9. and above is available under the GNU Public License. The wikitrans core and executables are not open sourced at present due to various Native American Antiquities Legal restrictions and are available only under direct license (and in some cases non-disclosure agreements from) the Wolf Mountain Group.

PHP Extension Sources
<?php if ( ! defined( 'MEDIAWIKI' ) ) die;

/**#@+ * A parser extension that adds tags, and * for machine translation of English to a target language. This extension * supports Cherokee. * * @package MediaWiki * @subpackage Extensions * * @author Jeff V. Merkey (jmerkey@wolfmountaingroup.com) * @copyright Copyright © 2006, WolfMountainGroup, Inc. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 3.0 or later for the MediaWiki PHP extension. */

//Add the hook function call to an array defined earlier in the wiki code execution. $wgExtensionFunctions[] = 'wikitrans'; $wgExtensionCredits['parserhook'][] = array(	'name' => 'Wikitrans',	'author' => 'Jeffrey Vernon Merkey',	'description' => 'adds chrtext and chrsyl tags which translate English into the Cherokee Language with text and unicode syllabary output',	'url' => 'http://www.wolfmountaingroup.com' );

//This is the hook function. It adds the tag to the wiki parser and tells it what callback function to use. function wikitrans { global $wgParser; # register the extension with the WikiText parser $wgParser->setHook( 'eng2chrtext', 'rendertext' ); $wgParser->setHook( 'eng2chrsyl', 'rendersyl' ); }

function rendertext( $input, $argv ) { global $IP;
 * 1) The callback function for converting the input text to HTML output

$output = $input; $cmd = "$IP/chr/wikitrans -lf $IP/chr/chr.lex -text -s ". wfEscapeShellArg($input); wfDebug( "wikitrans cmd:" . $cmd . "\n");

wfProfileIn(`wikitrans`); $output = wfShellExec( $cmd ); wfProfileOut(`wikitrans`);

wfDebug( "wikitrans:" . $output . "\n");

return $output; }

function rendersyl( $input, $argv ) { global $IP;

$output = $input; $cmd = "$IP/chr/wikitrans -syl -lf $IP/chr/chr.lex -text -s ". wfEscapeShellArg($input); wfDebug( "wikitrans cmd:" . $cmd . "\n");

wfProfileIn(`wikitrans`); $output = wfShellExec( $cmd ); wfProfileOut(`wikitrans`);

wfDebug( "wikitrans:" . $output . "\n");

return $output; }

?>