Page 1 of 1

gettext problems

Posted: Sat Oct 28, 2006 2:43 pm
by pedro84
Hello!

I try to make translate my site with gettext function.
I have reade thins manual: http://pl.php.net/manual/pl/function.gettext.php

But I have problem.

Languages on my main page changes with sessions, like this:

Code: Select all

<?php
session_start();
require_once("langman.php");
if(!SelectLanguage($_SESSION["lang"]))
	die("Error selecting language!");
?>

Everything Works, but don't work in other scripts. So i tried to translate them with gettext.

In main file of the script I put:

Code: Select all

setlocale(LC_ALL, $_SESSION["lang"] );
bindtextdomain("news", "./lang");
textdomain("news");
Exapmle .MO file:

Code: Select all

msgid "Football"
msgstr "Fussbal"
Path is corect as follow:
C:\usr\apache\httpd\html\news\lang\de_DE\LC_MESSAGES.

I call this by:

Code: Select all

echo _("Football");
And don't work.

Anyoe know what I'm doing wrong?