gettext übersetzt nicht / gettext doesn't translate

Alles, was PHP betrifft, kann hier besprochen werden.

gettext übersetzt nicht / gettext doesn't translate

Postby ZodiacXP » 18. April 2009 11:24

Following script shall be translated with the .pot under it, but it doesn't work.
The .mo and .po are located in ./locale/de_DE/LC_ALL

Servus. Folgendes Script:
Code: Select all
<?php
error_reporting(E_ALL);

ob_start("ob_gzhandler");

setlocale(LC_ALL, "de_DE");
bindtextdomain("test", "./locale");
textdomain("default");

echo gettext("Hello World!");

echo _("Hello to World!");

?>


Soll mit dieser .pot (als .mo):
Code: Select all
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-18 11:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: explain.php:10
msgid "Hello World!"
msgstr "Hallo Welt"

#: explain.php:12
msgid "Hello to World!"
msgstr "Moinsen"


Übersetzt werden. Jedoch erhalte ich keine Übersetzung.
Die default.mo und zugehörige .po liegt in ./locale/de_DE/LC_ALL

Fehlt mir zufällig noch was?
Arbeitet jemand mit Eclipse und kann mir sagen wie man bequem von da aus .mo Dateien generieren kann?
Über shell ist immer umständlich.
ZodiacXP
 
Posts: 21
Joined: 01. August 2005 07:01
Location: In einem Haus

Re: gettext übersetzt nicht / gettext doesn't translate

Postby Wiedmann » 18. April 2009 12:00

Tja, /me leider keine Ahnung von gettext...

Aber was anderes:
Code: Select all
setlocale(LC_ALL, "de_DE");

Was liefert denn diese Funktion zurück?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: gettext übersetzt nicht / gettext doesn't translate

Postby ZodiacXP » 18. April 2009 12:22

Ui. Das ist FALSE.

"de_DE" existierte nicht.
Code: Select all
setlocale(LC_ALL, "German_Germany")

Wird aber weiterhin nichts übersetzt. (Pfade wurden angeglichen)
Muss PHP erst neu kompiliert werden mit "liblintl" ? Um LC_MESSAGES drin zu haben (http://de2.php.net/manual/de/function.setlocale.php)
Wenn ja, wie stellt man das an?

Oder ists ein anderer Fehler?

Auch mein erstes mal mit gettext ;)
ZodiacXP
 
Posts: 21
Joined: 01. August 2005 07:01
Location: In einem Haus


Return to PHP

Who is online

Users browsing this forum: No registered users and 16 guests