gettext problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pedro84
Forum Newbie
Posts: 11
Joined: Sat Oct 21, 2006 11:28 am

gettext problems

Post 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?
Post Reply