Skip to content
Permalink
Browse files

MDL-18766 Towards improved translation

  • Loading branch information...
stronk7
stronk7 committed Apr 1, 2009
1 parent 497bad9 commit c66158102ea786086abae5220e8f7e538bd76f8f
Showing with 26 additions and 2 deletions.
  1. +2 −1 lang/en_utf8/autotranslate.php
  2. +24 −1 lib/autotranslatelib.php
@@ -4,5 +4,6 @@
$string['configautotranslate'] = 'This is a prototype automatic translation system for Moodle, like http://translate.google.com/, but better. At least it will be better in due course, it is still early days and only a few target languages are supported. Improvements to the algorithms are welcome.';
$string['targetlang_cs_ps'] = 'xIxlxaF0aW5hIChQZXRyIFNrb2Rhayk=';
$string['targetlang_en_nz_pl'] = 'S2l3aSAoUGVubnkgTGVhY2gp';
$string['targetlang_en_uk_pl'] = 'QmFzc29vbiAoVGltIEh1bnQp';
$string['targetlang_null'] = 'Tm8gdHJhbnNsYXRpb24=';
?>
?>
@@ -65,7 +65,7 @@ function auto_translate_target_languages() {
if (!is_null($list)) {
return $list;
}
$codes = array('null', 'cs_ps', 'en_nz_pl');
$codes = array('null', 'cs_ps', 'en_nz_pl', 'en_uk_pl');
$list = array();
foreach ($codes as $code) {
$name = get_string('targetlang_' . $code, 'autotranslate');
@@ -216,3 +216,26 @@ public function translate_word($word) {
return $this->library[($len - 1) % $this->librarylen];
}
}
class en_uk_pl_auto_translator extends word_by_word_translator {
private $library = null;
private $librarylen;
private function ensure_library_loaded() {
if (is_null($this->library)) {
$this->library = unserialize(base64_decode(
'YTo5OntpOjA7czo0OiJjb29sIjtpOjE7czoyOiJ0aCI7aToyO3M6NToiY3Jh' .
'enkiO2k6MztzOjc6ImJhc3Nvb24iO2k6NDtzOjEzOiJjb250cmFiYXNzb29u' .
'IjtpOjU7czoxMzoiZ28gKHRoZSBnYW1lKSI7aTo2O3M6ODoicXVpei1tYW4i' .
'O2k6NztzOjM6Im1hZCI7aTo4O3M6NDoicnRmbSI7fQ=='));
$this->librarylen = count($this->library);
}
}
public function translate_word($word) {
$len = strlen($word);
if ($len == 0) {
return '';
}
$this->ensure_library_loaded();
return $this->library[($len - 1) % $this->librarylen];
}
}

0 comments on commit c661581

Please sign in to comment.
You can’t perform that action at this time.