Hi,
I believe the following patch should allow the translation of all the
user viewable string of poker-web pages by surrounding them with the
gettext '_()' macro.
Please review it before inclusion.
Index: pokerweb/pages/edit_account.php
===================================================================
--- pokerweb/pages/edit_account.php (revision 2817)
+++ pokerweb/pages/edit_account.php (working copy)
@@ -118,71 +118,71 @@
<table>
<tr>
<td></td>
- <td>Edit Account</td>
+ <td><? echo _('Edit Account') ?></td>
</tr>
<tr>
- <td><b>Login<sup>*</sup>:</b></td>
+ <td><b><? echo _('Login') ?><sup>*</sup>:</b></td>
<td><input type="hidden" id="name" name="name" value="<?php print $account['name'] ?>"><?php print $account['name'] ?></td>
</tr>
<tr>
- <td><b>New password<sup>*</sup>:</b></td>
+ <td><b><? echo _('New password') ?><sup>*</sup>:</b></td>
<td><input type="password" size="20" maxlength="32" id="password2" name="password2" /></td>
</tr>
<tr>
- <td><b>New Password confirmation<sup>*</sup>:</b></td>
+ <td><b><? echo _('New Password confirmation') ?><sup>*</sup>:</b></td>
<td><input type="password" size="20" maxlength="32" id="password3" name="password3" /></td>
</tr>
<tr>
- <td><b>Email<sup>*</sup>:</b></td>
+ <td><b><? echo _('Email') ?><sup>*</sup>:</b></td>
<td><input type="text" size="32" maxlength="128" id="email" name="email" value="<?php print $account['email'] ?>" /></td>
</tr>
<tr>
- <td><b>Phone:</b></td>
+ <td><b><? echo _('Phone') ?>:</b></td>
<td><input type="text" size="40" maxlength="64" id="phone" name="phone" value="<?php print $account['phone'] ?>" /></td>
</tr>
<tr>
- <td><b>First Name:</b></td>
+ <td><b><? echo _('First Name') ?>:</b></td>
<td><input type="text" size="32" maxlength="32" id="firstname" name="firstname" value="<?php print $account['firstname'] ?>" /></td>
</tr>
<tr>
- <td><b>Last Name:</b></td>
+ <td><b><? echo _('Last Name') ?>:</b></td>
<td><input type="text" size="32" maxlength="32" id="lastname" name="lastname" value="<?php print $account['lastname'] ?>" /></td>
</tr>
<tr>
- <td><b>Gender:</b></td>
+ <td><b><? echo _('Gender') ?>:</b></td>
<td>
<select id="gender" name="gender">
- <option value="M" <?php $account['gender'] == 'M' ? 'selected="selected"' : '' ?>>Mr</option>
- <option value="F" <?php $account['gender'] == 'F' ? 'selected="selected"' : '' ?>>Miss</option>
+ <option value="M" <?php $account['gender'] == 'M' ? 'selected="selected"' : '' ?>><? echo _('Mr') ?></option>
+ <option value="F" <?php $account['gender'] == 'F' ? 'selected="selected"' : '' ?>><? echo _('Miss') ?></option>
</select>
</td>
</tr>
<tr>
- <td><b>Birthday:</b></td>
+ <td><b><? echo _('Birthday') ?>:</b></td>
<td><?php print $birthday->form(); ?></td>
</tr>
<tr>
- <td><b>Street:</b></td>
+ <td><b><? echo _('Street') ?>:</b></td>
<td><textarea id="addr_street" name="addr_street" cols="30" rows="3"><?php print $account['addr_street'] ?></textarea></td>
</tr>
<tr>
- <td><b>Street 2:</b></td>
+ <td><b><? echo _('Street') ?> 2:</b></td>
<td><textarea id="addr_street2" name="addr_street2" cols="30" rows="3"><?php print $account['addr_street2'] ?></textarea></td>
</tr>
<tr>
- <td><b>Zip code:</b></td>
+ <td><b><? echo _('Zip code') ?>:</b></td>
<td><input type="text" size="20" maxlength="64" id="addr_zip" name="addr_zip" value="<?php print $account['addr_zip'] ?>" /></td>
</tr>
<tr>
- <td><b>Town:</b></td>
+ <td><b><? echo _('Town') ?>:</b></td>
<td><input type="text" size="50" maxlength="64" id="addr_town" name="addr_town" value="<?php print $account['addr_town'] ?>" /></td>
</tr>
<tr>
- <td><b>State:</b></td>
+ <td><b><? echo _('State') ?>:</b></td>
<td><input type="text" size="50" maxlength="128" id="addr_state" name="addr_state" value="<?php print $account['addr_state'] ?>" /></td>
</tr>
<tr>
- <td><b>Country:</b></td>
+ <td><b><? echo _('Country') ?>:</b></td>
<td>
<select id="addr_country" name="addr_country">
<?php
@@ -202,10 +202,10 @@
<td></td>
<td>
<img src="image.php?serial=<? print $serial ?>" />
- <b>Avatar: <input type="file" name="image"></b><br />
+ <b><? echo _('Avatar') ?>: <input type="file" name="image"></b><br />
<td></td>
<td>
- <input type="submit" name='submit' value="Ok" />
+ <input type="submit" name='submit' value="<? echo _('Ok') ?>" />
</td>
</tr>
</table>
Index: pokerweb/pages/cash_in.php
===================================================================
--- pokerweb/pages/cash_in.php (revision 2817)
+++ pokerweb/pages/cash_in.php (working copy)
@@ -90,10 +90,10 @@
<table>
<tr>
<td></td>
- <td>Cash-In</td>
+ <td><? echo _('Cash-In') ?></td>
</tr>
<tr>
- <td><b>Amount:</b></td>
+ <td><b><? echo _('Amount') ?>:</b></td>
<td>
<input type="text" name="amount" value="<?php echo $amount; ?>" />
</td>
@@ -101,7 +101,7 @@
<tr>
<td></td>
<td>
- <input type="submit" name='submit' value="Ok" />
+ <input type="submit" name='submit' value="<? echo _('Ok') ?>" />
</td>
</tr>
</table>
Index: pokerweb/pages/cash_out.php
===================================================================
--- pokerweb/pages/cash_out.php (revision 2817)
+++ pokerweb/pages/cash_out.php (working copy)
@@ -82,10 +82,10 @@
<table>
<tr>
<td></td>
- <td>Cash-Out</td>
+ <td><? echo _('Cash-Out') ?></td>
</tr>
<tr>
- <td><b>Amount:</b></td>
+ <td><b><? echo _('Amount') ?>:</b></td>
<td>
<input type="text" name="amount" value="<?php echo $amount; ?>" />
</td>
@@ -93,7 +93,7 @@
<tr>
<td></td>
<td>
- <input type="submit" name='submit' value="Ok" />
+ <input type="submit" name='submit' value="<? echo _('Ok') ?>" />
</td>
</tr>
</table>
Index: pokerweb/pages/index.php
===================================================================
--- pokerweb/pages/index.php (revision 2817)
+++ pokerweb/pages/index.php (working copy)
@@ -47,17 +47,17 @@
echo '<!-- HOME IS LOGGED IN -->';
if(is_array($user_info['money'])) {
foreach ( $user_info['money'] as $currency => $state ) {
- print "bankroll ".substr($state[0], 0, -2).".".substr($state[0], -2).", in game ".$state[1].", point ".$state[2]." (currency ".$currency.")<p>";
+ print _('bankroll')." ".substr($state[0], 0, -2).".".substr($state[0], -2).", "._('in game')." ".$state[1].", "._('point')." ".$state[2]." ("._('currency')." ".$currency.")<p>";
}
}
- echo '<a href="logout.php" id="logout">logout</a><br>';
- echo '<a href="edit_account.php" id="edit_account">Edit Account</a><br>';
- echo '<a href="cash_in.php" id="cash_in">Cash-In</a><br>';
- echo '<a href="cash_out.php" id="cash_out">Cash-Out</a><br>';
+ echo '<a href="logout.php" id="logout">'._('Log out').'</a><br>';
+ echo '<a href="edit_account.php" id="edit_account">'._('Edit Account').'</a><br>';
+ echo '<a href="cash_in.php" id="cash_in">'._('Cash-In').'</a><br>';
+ echo '<a href="cash_out.php" id="cash_out">'._('Cash-Out').'</a><br>';
} else {
echo '<!-- HOME NOT LOGGED IN -->';
- echo '<a href="login.php" id="login">login</a><br>';
- echo '<a href="create_account.php" id="create_account">Create Account</a><br>';
+ echo '<a href="login.php" id="login">'._("Log in").'</a><br>';
+ echo '<a href="create_account.php" id="create_account">'._('Create Account').'</a><br>';
}
hci_footer();
Index: pokerweb/pages/login.php
===================================================================
--- pokerweb/pages/login.php (revision 2817)
+++ pokerweb/pages/login.php (working copy)
@@ -62,23 +62,23 @@
<table>
<tr>
<td></td>
- <td>Login</td>
+ <td><? echo _('Log in') ?></td>
</tr>
<tr>
- <td><b>Login:</b></td>
+ <td><b><? echo _('Login') ?>:</b></td>
<td><input type="text" maxlength="32" name="login" value="<?php echo $name?>" /></td>
</tr>
<tr>
- <td><b>Password:</b></td>
+ <td><b><? echo _('Password') ?>:</b></td>
<td><input type="password" maxlength="32" name="password" id="password" /></td>
</tr>
<tr>
<td></td>
- <td><a href="create_account.php">Create account</a></td>
+ <td><a href="create_account.php"><? echo _('Create Account') ?></a></td>
</tr>
<tr>
<td></td>
- <td><input type="submit" name='submit' value="Ok" /></td>
+ <td><input type="submit" name='submit' value="<? echo _('Ok') ?>" /></td>
</tr>
</table>
</form>
Index: pokerweb/pages/create_account.php
===================================================================
--- pokerweb/pages/create_account.php (revision 2817)
+++ pokerweb/pages/create_account.php (working copy)
@@ -99,71 +99,71 @@
<table>
<tr>
<td></td>
- <td>Create Account</td>
+ <td><? echo _('Create Account') ?></td>
</tr>
<tr>
- <td><b>Login<sup>*</sup>:</b></td>
+ <td><b><? echo _('Login') ?><sup>*</sup>:</b></td>
<td><input type="text" size="20" maxlength="32" id="name" name="name" value="<?php print $account['name'] ?>" /></td>
</tr>
<tr>
- <td><b>Password<sup>*</sup>:</b></td>
+ <td><b><? echo _('Password') ?><sup>*</sup>:</b></td>
<td><input type="password" size="20" maxlength="32" id="password" name="password" /></td>
</tr>
<tr>
- <td><b>Password confirmation<sup>*</sup>:</b></td>
+ <td><b><? echo _('Password confirmation') ?><sup>*</sup>:</b></td>
<td><input type="password" size="20" maxlength="32" id="password2" name="password2" /></td>
</tr>
<tr>
- <td><b>Email<sup>*</sup>:</b></td>
+ <td><b><? echo _('Email') ?><sup>*</sup>:</b></td>
<td><input type="text" size="32" maxlength="128" id="email" name="email" value="<?php print $account['email'] ?>" /></td>
</tr>
<tr>
- <td><b>Phone:</b></td>
+ <td><b><? echo _('Phone') ?>:</b></td>
<td><input type="text" size="40" maxlength="64" id="phone" name="phone" value="<?php print $account['phone'] ?>" /></td>
</tr>
<tr>
- <td><b>First Name:</b></td>
+ <td><b><? echo _('First Name') ?>:</b></td>
<td><input type="text" size="32" maxlength="32" id="firstname" name="firstname" value="<?php print $account['firstname'] ?>" /></td>
</tr>
<tr>
- <td><b>Last Name:</b></td>
+ <td><b><? echo _('Last Name') ?>:</b></td>
<td><input type="text" size="32" maxlength="32" id="lastname" name="lastname" value="<?php print $account['lastname'] ?>" /></td>
</tr>
<tr>
- <td><b>Gender:</b></td>
+ <td><b><? echo _('Gender') ?>:</b></td>
<td>
<select id="gender" name="gender">
- <option value="M" <?php $account['gender'] == 'M' ? 'selected="selected"' : '' ?>>Mr</option>
- <option value="F" <?php $account['gender'] == 'F' ? 'selected="selected"' : '' ?>>Miss</option>
+ <option value="M" <?php $account['gender'] == 'M' ? 'selected="selected"' : '' ?>><? echo _('Mr') ?></option>
+ <option value="F" <?php $account['gender'] == 'F' ? 'selected="selected"' : '' ?>><? echo _('Miss') ?></option>
</select>
</td>
</tr>
<tr>
- <td><b>Birthday:</b></td>
+ <td><b><? echo _('Birthday') ?>:</b></td>
<td><?php print $birthday->form(); ?></td>
</tr>
<tr>
- <td><b>Street:</b></td>
+ <td><b><? echo _('Street') ?>:</b></td>
<td><textarea id="addr_street" name="addr_street" cols="30" rows="3"><?php print $account['addr_street'] ?></textarea></td>
</tr>
<tr>
- <td><b>Street 2:</b></td>
+ <td><b><? echo _('Street') ?> 2:</b></td>
<td><textarea id="addr_street2" name="addr_street2" cols="30" rows="3"><?php print $account['addr_street2'] ?></textarea></td>
</tr>
<tr>
- <td><b>Zip code:</b></td>
+ <td><b><? echo _('Zip code') ?>:</b></td>
<td><input type="text" size="20" maxlength="64" id="addr_zip" name="addr_zip" value="<?php print $account['addr_zip'] ?>" /></td>
</tr>
<tr>
- <td><b>Town:</b></td>
+ <td><b><? echo _('Town') ?>:</b></td>
<td><input type="text" size="50" maxlength="64" id="addr_town" name="addr_town" value="<?php print $account['addr_town'] ?>" /></td>
</tr>
<tr>
- <td><b>State:</b></td>
+ <td><b><? echo _('State') ?>:</b></td>
<td><input type="text" size="50" maxlength="128" id="addr_state" name="addr_state" value="<?php print $account['addr_state'] ?>" /></td>
</tr>
<tr>
- <td><b>Country:</b></td>
+ <td><b><? echo _('Country') ?>:</b></td>
<td>
<select id="addr_country" name="addr_country">
<?php
@@ -181,7 +181,7 @@
</tr>
<tr>
<td></td>
- <td><input type="submit" name='submit' value="Ok" /></td>
+ <td><input type="submit" name='submit' value="<? echo _('Ok') ?>" /></td>
</tr>
</table>
</form>
Index: pokerweb/pages/poker.php
===================================================================
--- pokerweb/pages/poker.php (revision 2817)
+++ pokerweb/pages/poker.php (working copy)
@@ -87,7 +87,7 @@
if($packets) {
switch ($packets[0]['type']) {
case 'PacketAuthRefused':
- throw new Exception('Authentication failed, ' . $packets[0]['message'], self::E_LOGIN_FAILED);
+ throw new Exception(_('Authentication failed').", " . _($packets[0]['message']), self::E_LOGIN_FAILED);
break;
case 'PacketAuthOk':
if($packets[1]['type'] == 'PacketSerial') {
--
Johan Euphrosine
[EMAIL PROTECTED]
_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users