diff options
Diffstat (limited to 'tdd/tdd-bootstrap.php')
-rw-r--r-- | tdd/tdd-bootstrap.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tdd/tdd-bootstrap.php b/tdd/tdd-bootstrap.php index de78192..0db3fa1 100644 --- a/tdd/tdd-bootstrap.php +++ b/tdd/tdd-bootstrap.php @@ -8,12 +8,20 @@ class Protocol { $this->prefix = $prefix; $this->round = $round; $this->board = $board; + $this->translations = json_decode(file_get_contents('translations.json'), TRUE); $this->deals_by_tables = array(); if(!file_exists($this->get_filename())) { throw new Exception('file not found: ' . $this->get_filename()); } } + function __($string) { + if (isset($this->translations[$string])) { + return $this->translations[$string]; + } + return $string; + } + function get_filename() { return '..' . DIRECTORY_SEPARATOR . $this->prefix . $this->round . 'b-' . $this->board . '.html'; } @@ -43,7 +51,7 @@ class Protocol { $score2 = trim(str_replace(' ', '', $nextTr->find('td', 5)->innertext)); $deal = $this->deals_by_tables[$table]; - $insert = "<a href=\"#table-$table\"><h4 id=\"table-$table\">Stół $table – Rozdanie {$deal->deal_num}</h4></a>"; + $insert = "<a href=\"#table-$table\"><h4 id=\"table-$table\">" . $this->__("Stół") . " $table" . " – " . $this->__("Rozdanie") . " {$deal->deal_num}</h4></a>"; // if is played on both tables of a match // note that the contract field for arbitral scores starts with 'A' (e.g. 'ARB' or 'AAA') if(($score1 !== '' || strpos($contract1, 'A') === 0) |