I'm trying to find how I can localize using gettext the following form:
Code: Select all
<?php
if (!empty($_GET["error"]))
{
switch ($_GET["error"])
{
case "not_enough_info": ?>
<strong style="color: red;">You need to complete all fields marked *<br/>
and also be sure that you type the security code as it appears in the image.<strong><?php
break;
case "invalid_email": ?>
<strong style="color: red;">Please provide a valid email address</strong><?php
break;
case "upload_failed": ?>
<strong style="color: red;">The file you uploaded failed to attach, this could be a temporary problem.
Please try later.</strong><?php
break;
case "sending_failed": ?>
<strong style="color: red;">Temporary problem, please try later.</strong><?php
break;
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact Form</title>
<meta name="description" content="contact form" />
<meta name="keywords" content="Contact form, contact us. " />
<!-- <link href="../../css/main.css" rel="stylesheet" type="text/css" /> -->
</head>
<body>
<form action="handle_form.php" method="post" enctype="multipart/form-data">
<table>
<tr>
<td class="label">Name *</td>
<td><input type="text" name="sender_name" value="" /></td>
</tr>
<tr>
<td class="label">E-mail address *</td>
<td><input type="text" name="sender_email" value="" /></td>
</tr>
<tr>
<td class="label">Title *</td>
<td><input type="text" name="comment_title" value="" /></td>
</tr>
<tr>
<td class="label">Attachment (optional)</td>
<td><input type="file" name="attachment" /></td>
</tr>
<tr>
<td colspan="2">Comment *<br />
<textarea name="comment_body" rows="10" cols="60"></textarea></td>
</tr>
<tr>
<td>Security Code: *
<input id="security_code" name="security_code" type="text" />
<img src="../../includes/captcha.php?width=150&height=50&characters=5" />
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>echo gettext("some comments");
How can I use the above to translate the comments between the case for example and also to the html form?
Is there a way to do that or I need to create a seperate file/form for each language?
The po files etc are already fine and working. I just need to find how I can use gettext() to translate the non echo values.
Thanks a lot