summaryrefslogtreecommitdiff
path: root/tdd
diff options
context:
space:
mode:
Diffstat (limited to 'tdd')
-rw-r--r--tdd/tdd-bootstrap.php14
-rw-r--r--tdd/tdd-handrecord-tpl.php6
-rw-r--r--tdd/translations.json3
3 files changed, 14 insertions, 9 deletions
diff --git a/tdd/tdd-bootstrap.php b/tdd/tdd-bootstrap.php
index 0db3fa1..c4249c9 100644
--- a/tdd/tdd-bootstrap.php
+++ b/tdd/tdd-bootstrap.php
@@ -4,20 +4,24 @@ require_once('tdd-simple-html-dom.php');
class Protocol {
+ private static $translations = array();
+
function __construct($prefix, $round, $board) {
$this->prefix = $prefix;
$this->round = $round;
$this->board = $board;
- $this->translations = json_decode(file_get_contents('translations.json'), TRUE);
+ if (file_exists('translations.json')) {
+ static::$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];
+ static function __($string) {
+ if (isset(static::$translations[$string])) {
+ return static::$translations[$string];
}
return $string;
}
@@ -51,7 +55,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\">" . $this->__("Stół") . " $table" . " &ndash; " . $this->__("Rozdanie") . " {$deal->deal_num}</h4></a>";
+ $insert = "<a href=\"#table-$table\"><h4 id=\"table-$table\">" . static::__("Stół") . " $table" . " &ndash; " . static::__("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)
diff --git a/tdd/tdd-handrecord-tpl.php b/tdd/tdd-handrecord-tpl.php
index 65836cf..da2335a 100644
--- a/tdd/tdd-handrecord-tpl.php
+++ b/tdd/tdd-handrecord-tpl.php
@@ -11,7 +11,7 @@
</tr>
<tr>
<td><?php echo $this->format_hand(3); ?></td>
- <td><img src="images/<?php echo ($this->deal_num)%16 ? ($this->deal_num)%16 : 16; ?>.gif"
+ <td><img src="images/<?php echo ($this->deal_num)%16 ? ($this->deal_num)%16 : 16; ?>.gif"
alt="<?php echo $this->dealer.'/'.$this->vuln; ?>" /></td>
<td><?php echo $this->format_hand(1); ?></td>
</tr>
@@ -22,7 +22,7 @@
</tr>
<?php if($this->ability): ?>
<tr><td colspan="5">
- <small class="sm">Maksymalna liczba lew:</small>
+ <small class="sm"><?php echo Protocol::__("Maksymalna liczba lew"); ?>:</small>
<table class="ability" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="an2">&nbsp;</td>
@@ -50,7 +50,7 @@
<?php echo $this->format_ability(3); ?>
</tr>
</table>
- Minimax: <?php echo $this->format_minimax(); ?>
+ <?php echo Protocol::__("Minimax"); ?>: <?php echo $this->format_minimax(); ?>
</td></tr>
<?php endif; ?>
</table>
diff --git a/tdd/translations.json b/tdd/translations.json
index e7387aa..9761aeb 100644
--- a/tdd/translations.json
+++ b/tdd/translations.json
@@ -1,4 +1,5 @@
{
"Stół": "Table",
- "Rozdanie": "Board"
+ "Rozdanie": "Board",
+ "Maksymalna liczba lew": "Makeable tricks"
}