Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have a multi language site with possibilities to choose between english, french, german, italien and spanish.
To do this I keep a config file for each language and each file has an entry using the define command for
many variables. For example for a variable NATION each language file would have the approporiate definition and so in the french file I would have a line
define("NATION","Nationalité");
Here is a short example of what the php file would look like.
index.phpCode: Select all
<?php
session_start();
ini_set('arg_separator.output','&');
echo("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
$mylang = 'fr';
require_once( "../language/lang-$mylang.php" );
// next tline commented out. It appears in lan-fr.php
//define("NATION","Nationalité");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1 "/>
<title>Test1</title>
</head>
<body>
<? echo NATION ?>
<P>
Nationalité
</body>
</html>Nationalité
Nationalité
As you can see the variable NATION has been correctly resolved but the string in the file is not displayed as I would want. If I change ISO-8859-1 to UTF-8 in this file then I get the opposite result:
Nationalit鼐>
Nationalité
This is annoying and is confusing me.
I need to use the line
require_once( "../language/lang-$mylang.php" );
to get the correct language definitions and I think that the problem lies here, as if I define the variable within
this index.php file then it works out fine.
Can anyone help explain this?
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]