Firefox PHP

Language recognition

Posted by Ulf Dunkel 
Language recognition
August 15, 2005 02:17PM
As seen in Phorum 3, Phorum 5 still seems to have the same problems when one uses foreign languages in a setup of different Phorums. In my case, I offer 5 separate Phorums (cz, de, fr, nl and us). The Czech one caused problems as my Apache server sets the default charset to iso-8859-1. Thus, I had to recognize the current language of the Phorum myself (again). In Phorum 5, I did not find another smart way but evaluating the query string. This is, how I enhanced my /templates/myTemplate/header.tpl in order to avoid character garbage.

(Maybe someone knows a smarter but working way or someone can find this posting helpful.)

$forum_number = $_SERVER['QUERY_STRING'];
$forum_queries = explode(",",$forum_number);
if (!$forum_queries[0])
	$forum_queries[0] = $_POST['forum_id'];
case "8":
  $PHORUM['locale'] = "fr_FR";
  $xml_type = '<?xml version="1.0" encoding="iso-8859-1"?>';
  $lan = "fr"; break;
case "7":
  $PHORUM['locale'] = "CZ";
  $xml_type = '<?xml version="1.0" encoding="windows-1250"?>';
  $lan = "cz"; break;
case "3":
  $PHORUM['locale'] = "nl_NL";
  $xml_type = '<?xml version="1.0" encoding="iso-8859-1"?>';
  $lan = "nl"; break;
case "2":
  $PHORUM['locale'] = "en_EN";
  $xml_type = '<?xml version="1.0" encoding="iso-8859-1"?>';
  $lan = "us"; break;
case "1":
  $PHORUM['locale'] = "de_DE";
  $xml_type = '<?xml version="1.0" encoding="iso-8859-1"?>';
  $lan = "de";
if($lan == "cz")
  header("Content-type: text/html;charset=windows-1250");
echo $xml_type;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html lang="<?php echo $PHORUM['locale']; ?>">
<meta http-equiv="refresh" content="5; url={URL->REDIRECT}" />
// use and output my own website's framework
include "../lib.php";
<div align="{forumalign}">
<div class="PDDiv">
{IF notice_all}
<div class="PhorumNotificationArea PhorumNavBlock">
<a class="PhorumNavLink" href="{PRIVATE_MESSAGES->inbox_url}">
{LANG->NewPrivateMessages}</a><br />{/IF}
{IF notice_messages}
<a class="PhorumNavLink" href="{notice_messages_url}">
{LANG->UnapprovedMessagesLong}</a><br />{/IF}
{IF notice_users}
<a class="PhorumNavLink" href="{notice_users_url}">
{LANG->UnapprovedUsersLong}</a><br />{/IF}
{IF notice_groups}
<a class="PhorumNavLink" href="{notice_groups_url}">
{LANG->UnapprovedGroupMembers}</a><br />{/IF}
{IF NAME}<span class="PhorumTitleText PhorumLargeFont">{NAME}:&nbsp;</span>{/IF}
{IF DESCRIPTION}<div class="PhorumFloatingText">{DESCRIPTION}</div>{/IF}

Regards, Ulf Dunkel
Sorry, only registered users may post in this forum.

Click here to login