extract rules-related strings from variable and moved into rules_base file
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 27 Feb 2017 17:36:16 +0000 (18:36 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 27 Feb 2017 17:36:16 +0000 (18:36 +0100)
web/briskin5/Obj/briskin5.phh
web/briskin5/Obj/rules_base.phh
web/briskin5/Obj/rules_old_rules.phh

index 4e5b406..91fb9c7 100644 (file)
@@ -40,6 +40,21 @@ $mlang_bin5_bin5 = array(
                                                'en' => '%3$slast hand%4$s'),
                          'info_curr' => array( 'it' => '%3$smano corrente%4$s',
                                                'en' => '%3$scurrent hand%4$s'),
+                         'info_yshuf'=> array( 'it' => 'Fai <b>tu</b> il mazzo, ',
+                                               'en' => 'It\'s <b>your</b> shuffled the cards, '),
+                         'info_shuf' => array( 'it' => 'Il mazzo a <b>%s</b>, ',
+                                               'en' => '<b>%s</b> shuffled the cards, '),
+                         'info_yturn'=> array( 'it' => ' tocca a <b>te</b> giocare.',
+                                               'en' => ' it\'s <b>your</b> turn.'),
+                         'info_turn' => array( 'it' => 'tocca a <b>%s</b> giocare.',
+                                               'en' => 'it\'s the <b>%s</b>\'s turn.'),
+                         'info_mult' => array( 'it' => ' La partita vale <b>%s</b>.',
+                                               'en' => ' The game worth <b>%s</b>.' ),
+                         'info_match'=> array( 'it' => 'Il codice della partita è <b>%d</b>.',
+                                               'en' => 'Match code is <b>%d</b>.'),
+
+
+
                          // br, hr, b, /b, win, fri
                          'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s (punti torneo %7$d), il socio era %3$s%6$s%4$s,%1$s',
                                                'en' => 'The declarer was %3$s%5$s%4$s (tournment points %7$d), the partner was %3$s%6$s%4$s,%1$s'),
@@ -85,18 +100,6 @@ $mlang_bin5_bin5 = array(
                          'info_aban' => array( 'it' => ' Ha lasciato %3$s%5$s%4$s perché aveva al massimo %3$s2 punti%4$s.',
                                                'en' => ' EN: Ha lasciato %3$s%5$s%4$s perché aveva al massimo %3$s2 punti%4$s.'),
 
-                         'info_shuf' => array( 'it' => 'Il mazzo a <b>%s</b>, ',
-                                               'en' => '<b>%s</b> shuffled the cards, '),
-                         'info_yturn'=> array( 'it' => ' tocca a <b>te</b> giocare.',
-                                               'en' => ' it\'s <b>your</b> turn.'),
-                         'info_turn' => array( 'it' => 'tocca a <b>%s</b> giocare.',
-                                               'en' => 'it\'s the <b>%s</b>\'s turn.'),
-                         'info_mult' => array( 'it' => ' La partita vale <b>%s</b>.',
-                                               'en' => ' The game worth <b>%s</b>.' ),
-                         'info_yshuf'=> array( 'it' => 'Fai <b>tu</b> il mazzo, ',
-                                               'en' => 'It\'s <b>your</b> shuffled the cards, '),
-                         'info_match'=> array( 'it' => 'Il codice della partita è <b>%d</b>.',
-                                               'en' => 'Match code is <b>%d</b>.'),
                          'btn_bkgame'=> array( 'it' => 'torna alla partita',
                                                'en' => 'back to the game'),
                          'call_wptn' => array( 'it' => '<br>con %d punti',
index 779e3af..b102f8f 100644 (file)
 
 require_once("briskin5.phh");
 
+$mlang_bin5_rules = array(
+                         // br, hr, b, /b, win, fri
+                         'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s (punti torneo %7$d), il socio era %3$s%6$s%4$s,%1$s',
+                                               'en' => 'The declarer was %3$s%5$s%4$s (tournment points %7$d), the partner was %3$s%6$s%4$s,%1$s'),
+                         // br, hr, b, /b
+                         'info_capp' => array( 'it' => 'hanno fatto %3$scappotto%4$s EBBRAVI!.%1$s',
+                                               'en' => 'and they made %3Dscapot%4$s WELL DONE!.%1$s'),
+
+                         // br, hr, b, /b, old_asta_pnt, old_pnt, winornot
+                         'info_alea' => array( 'it' => 'dovevano fare %3$salmeno %5$d%4$s punti e ne hanno fatti %3$s%6$d%4$s: hanno %7$s.%1$s',
+                                               'en' => 'they had to do %3$sat least %5$d%4$s points and they had made %3$s%6$d%4$s: they have %7$s.%1$s'),
+                         // br, hr, b, /b, old_pnt, winornot
+                         'info_more' => array( 'it' => 'dovevano fare %3$spiù di 60%4$s punti e ne hanno fatti %3$s%5$d%4$s: hanno %6$s.%1$s',
+                                               'en' => 'they had to do %3$sover 60%4$s points and they had made %3$s%5$d%4$s: they have %3$s%6$s%4$s.%1$s'),
+                         'info_win'  => array( 'it' => 'vinto',
+                                               'en' => 'win'),
+                         'info_peer' => array( 'it' => 'pareggiato',
+                                               'en' => 'drew'),
+                         'info_lost' => array( 'it' => 'perso',
+                                               'en' => 'lost'),
+
+                         // br, hr, b, /b, win_name
+                         'info_alon' => array( 'it' => '%3$s%5$s%4$s si è chiamato in mano (punti torneo %6$d),%1$s',
+                                               'en' => '%3$s%5$s%4$s play alone against each other (tournment points %6$d),%1$s'),
+                         // br, hr, b, /b, old_asta_pnt, old_pnt, winornot
+                         'info_aleaa' => array( 'it' => 'doveva fare %3$salmeno %5$d%4$s punti e ne ha fatti %3$s%6$d%4$s: ha %3$s%7$s%4$s.%1$s',
+                                               'en' => 'he/she had to do %3$sat least %5$d%4$s points and they had made %3$s%6$d%4$s: he/she had %3$s%7$s%4$s.%1$s'),
+                         // br, hr, b, /b, old_pnt, winornot
+                         'info_morea' => array( 'it' => 'doveva fare %3$spiù di 60%4$s punti e ne ha fatti %3$s%5$d%4$s: ha %3$s%6$s%4$s.%1$s',
+                                                'en' => 'he/she had to do %3$smore than 60%4$s points and they had made %3$s%5$d%4$s: he/she had %3$s%6$s%4$s.%1$s'),
+                         // br, hr, b, /b
+                         'info_acap' => array( 'it' => 'ha fatto %3$scappotto%4$s EBBRAVO!.%1$s',
+                                               'en' => 'and he/she made %3$scapot%4$s WELL DONE!.%1$s'),
+
+                         // br, hr, b, /b
+                         'info_omul' => array( 'it' => '%1$sLa partita valeva %3$s%5$s%4$s.%1$s',
+                                               'en' => '%1$sEN: The game was worth %3$s%5$s%4$s.%1$s' ),
+
+                         // br, hr, b, /b
+                         'info_alpa' => array( 'it' => '%1$sHanno passato %3$stutti%4$s.%1$s',
+                                               'en' => '%1$sEN: Hanno passato %3$stutti%4$s.%1$s' ),
+
+                         // br, hr, b, /b, aband-name
+                         'info_aban' => array( 'it' => ' Ha lasciato %3$s%5$s%4$s perché aveva al massimo %3$s2 punti%4$s.',
+                                               'en' => ' EN: Ha lasciato %3$s%5$s%4$s perché aveva al massimo %3$s2 punti%4$s.')
+                          );
+
 abstract class Rules {
     var $table;
 
index a44cf3f..21fc253 100644 (file)
@@ -270,11 +270,11 @@ class Rules_old_rules extends Rules {
             return ("");
         }
         else if ($act == BIN5_RULES_ALLPASS) {
-            return (sprintf($mlang_bin5_bin5['info_alpa'][$G_lang],
+            return (sprintf($mlang_bin5_rules['info_alpa'][$G_lang],
                             $tg_br, $tg_hr, $tg_bo, $tg_bc));
         }
         else if ($act == BIN5_RULES_ABANDON) {
-            return (sprintf($mlang_bin5_bin5['info_aban'][$G_lang],
+            return (sprintf($mlang_bin5_rules['info_aban'][$G_lang],
                             $tg_br, $tg_hr, $tg_bo, $tg_bc,
                             $win_name));
         }
@@ -286,59 +286,59 @@ class Rules_old_rules extends Rules {
             if ($win != $fri) { // not alone case
                 /* MLANG: "<hr>Nell'ultima mano ha chiamato <b>%s</b>, il socio era <b>%s</b>,<br>", "hanno fatto <b>cappotto</b> EBBRAVI!.<hr>", "dovevano fare <b>%s</b> punti e ne hanno fatti <b>%d</b>: hanno <b>%s</b>.<hr>", "<hr>Nell'ultima mano <b>%s</b> si &egrave; chiamato in mano,<br>", "ha fatto <b>cappotto</b> EBBRAVO!.<hr>", "doveva fare <b>%s</b> punti e ne ha fatti <b>%d</b>: ha <b>%s</b>.<hr>", ($table->old_asta_pnt > 61 ? "almeno ".$table->old_asta_pnt : 'pi&ugrave; di 60'), $table->old_pnt, ($wol == 1 ? "vinto" : ($wol == 0 ? "pareggiato" : "perso" */
 
-                $noty .= sprintf($mlang_bin5_bin5['info_part'][$G_lang],
+                $noty .= sprintf($mlang_bin5_rules['info_part'][$G_lang],
                                  $tg_br, $tg_hr, $tg_bo, $tg_bc,
                                  $win_name,
                                  $fri_name,
                                  $old_tourn_pts);
                 if ($old_pnt == 120) {
-                    $noty .= sprintf($mlang_bin5_bin5['info_capp'][$G_lang],
+                    $noty .= sprintf($mlang_bin5_rules['info_capp'][$G_lang],
                                      $tg_br, $tg_hr, $tg_bo, $tg_bc );
                 }
                 else {
                     if ($old_asta_pnt > 61) {
-                        $noty .= sprintf($mlang_bin5_bin5['info_alea'][$G_lang],
+                        $noty .= sprintf($mlang_bin5_rules['info_alea'][$G_lang],
                                          $tg_br, $tg_hr, $tg_bo, $tg_bc,
                                          $old_asta_pnt, $old_pnt,
-                                         ($wol == 1 ? $mlang_bin5_bin5['info_win'][$G_lang] :
-                                          ($wol == 0 ? $mlang_bin5_bin5['info_peer'][$G_lang] :
-                                           $mlang_bin5_bin5['info_lost'][$G_lang])));
+                                         ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] :
+                                          ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] :
+                                           $mlang_bin5_rules['info_lost'][$G_lang])));
                     }
                     else {
-                        $noty .= sprintf($mlang_bin5_bin5['info_more'][$G_lang],
+                        $noty .= sprintf($mlang_bin5_rules['info_more'][$G_lang],
                                          $tg_br, $tg_hr, $tg_bo, $tg_bc,
                                          $old_pnt,
-                                         ($wol == 1 ? $mlang_bin5_bin5['info_win'][$G_lang] :
-                                          ($wol == 0 ? $mlang_bin5_bin5['info_peer'][$G_lang] :
-                                           $mlang_bin5_bin5['info_lost'][$G_lang])));
+                                         ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] :
+                                          ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] :
+                                           $mlang_bin5_rules['info_lost'][$G_lang])));
                     } // else of if ($old_asta_pnt > 61) {
                 } // else of if ($old_pnt == 120) {
             } // if ($win != $fri) { // not alone case
             else {
-                $noty .= sprintf($mlang_bin5_bin5['info_alon'][$G_lang],
+                $noty .= sprintf($mlang_bin5_rules['info_alon'][$G_lang],
                                  $tg_br, $tg_hr, $tg_bo, $tg_bc,
                                  $win_name,
                                  $old_tourn_pts);
                 if ($old_pnt == 120) {
-                    $noty .= sprintf($mlang_bin5_bin5['info_acap'][$G_lang],
+                    $noty .= sprintf($mlang_bin5_rules['info_acap'][$G_lang],
                                      $tg_br, $tg_hr, $tg_bo, $tg_bc);
                 }
                 else {
                     if ($old_asta_pnt > 61) {
-                        $noty .= sprintf($mlang_bin5_bin5['info_aleaa'][$G_lang],
+                        $noty .= sprintf($mlang_bin5_rules['info_aleaa'][$G_lang],
                                          $tg_br, $tg_hr, $tg_bo, $tg_bc,
                                          $old_asta_pnt, $old_pnt,
-                                         ($wol == 1 ? $mlang_bin5_bin5['info_win'][$G_lang] :
-                                          ($wol == 0 ? $mlang_bin5_bin5['info_peer'][$G_lang] :
-                                           $mlang_bin5_bin5['info_lost'][$G_lang])));
+                                         ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] :
+                                          ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] :
+                                           $mlang_bin5_rules['info_lost'][$G_lang])));
                     }
                     else {
-                        $noty .= sprintf($mlang_bin5_bin5['info_morea'][$G_lang],
+                        $noty .= sprintf($mlang_bin5_rules['info_morea'][$G_lang],
                                          $tg_br, $tg_hr, $tg_bo, $tg_bc,
                                          $old_pnt,
-                                         ($wol == 1 ? $mlang_bin5_bin5['info_win'][$G_lang] :
-                                          ($wol == 0 ? $mlang_bin5_bin5['info_peer'][$G_lang] :
-                                           $mlang_bin5_bin5['info_lost'][$G_lang])));
+                                         ($wol == 1 ? $mlang_bin5_rules['info_win'][$G_lang] :
+                                          ($wol == 0 ? $mlang_bin5_rules['info_peer'][$G_lang] :
+                                           $mlang_bin5_rules['info_lost'][$G_lang])));
                     }
                 }
             }
@@ -346,7 +346,7 @@ class Rules_old_rules extends Rules {
 
         $old_multer = static::s_multer($old_mult, $old_asta_pnt);
         if ($old_multer > 1) {
-            $noty .= sprintf($mlang_bin5_bin5['info_omul'][$G_lang],
+            $noty .= sprintf($mlang_bin5_rules['info_omul'][$G_lang],
                              $tg_br, $tg_hr, $tg_bo, $tg_bc,
                              multoval($old_multer));
         }