slomoman Geschrieben 16. April 2008 Geschrieben 16. April 2008 Ein PHP Modul dass ich verwende, nutzt GETTEXT( ) um die Texte in der korrekten Sprache auszugeben. Leider erscheint alles auf Englisch, obwohl ich Deutsch als Sprache ausgewählt habe. Gibt es eine Funktion, mit der ich die aktuell gesetze Sprache ermitteln kann (also sowas wie GET_LOCALE etc.)? Und kann ich irgendwo herausfinden, in welchem Ordner PHP die Übersetzungsdateien (.mo-Dateien) sucht? Ich habe das Gefühl, dass PHP nach "de_DE" oder "de_DE@euro" sucht, während die Dateien im Ordner "de" sind.
geloescht_JesterDay Geschrieben 16. April 2008 Geschrieben 16. April 2008 Und kann ich irgendwo herausfinden, in welchem Ordner PHP die Übersetzungsdateien (.mo-Dateien) sucht? RTFM? PHP: Introduction - Manual
slomoman Geschrieben 16. April 2008 Autor Geschrieben 16. April 2008 Was ist RTFM und wie nutze ich das? Ist das eine PHP funktion?
kein-tee Geschrieben 16. April 2008 Geschrieben 16. April 2008 Was ist RTFM Eine Abkürzung für Read the ****ing manual. Ein freundlicher Hinweis darauf, die Anleitung zu Rate zu ziehen. und wie nutze ich das? Du liest das Handbuch. PHP: Introduction - Manual Ist das eine PHP funktion? Nein.
slomoman Geschrieben 16. April 2008 Autor Geschrieben 16. April 2008 das Handbuch kannte ich schon. Ich habe dort keinen Hinweis gefunden, wie ich ermittle, welche Sprache im System eingestellt ist. Erst recht nicht via PHP (ich habe nämlich keinen Kommandozeilen-Zugriff auf dem Webserver).
geloescht_JesterDay Geschrieben 16. April 2008 Geschrieben 16. April 2008 11.2.3 Locating Message Catalog Files Because many different languages for many different packages have to be stored we need some way to add these information to file message catalog files. The way usually used in Unix environments is have this encoding in the file name. This is also done here. The directory name given in bindtextdomains second argument (or the default directory), followed by the name of the locale, the locale category, and the domain name are concatenated: dir_name/locale/LC_category/domain_name.mo The default value for dir_name is system specific. For the GNU library, and for packages adhering to its conventions, it's: /usr/local/share/locale locale is the name of the locale category which is designated by LC_category. For gettext and dgettext this LC_category is always LC_MESSAGES.3 The name of the locale category is determined through setlocale (LC_category, NULL). 4 When using the function dcgettext, you can specify the locale category through the third argument. ... 13.4.2 LINGUAS in po/ The po/ directory should also receive a file named LINGUAS. This file contains the list of available translations. It is a whitespace separated list. Hash-marked comments and white lines are ignored. Here is an example file: # Set of available languages. de fr This example means that German and French PO files are available, so that these languages are currently supported by your package. If you want to further restrict, at installation time, the set of installed languages, this should not be done by modifying the LINGUAS file, but rather by using the LINGUAS environment variable (see Installers). ... 15.5.19 PHP Hypertext Preprocessor ... setlocale Programmer must call setlocale (LC_ALL, "") ... An example is available in the examples directory: hello-php. Das waren doch alles Fragen von dir, oder nicht? Quelle s.o.
slomoman Geschrieben 17. April 2008 Autor Geschrieben 17. April 2008 Hmmm, ich frage mich immernoch, wie ich mit PHP-Mitteln (und nicht durch Stöbern in LINGUAS Dateien oder durch Aufrufen von "locale -a" auf der Kommandozeile des Webservers) herausfinde, welche Sprache gerade verwendet wird.
geloescht_JesterDay Geschrieben 17. April 2008 Geschrieben 17. April 2008 system (PHP 4, PHP 5) system — Execute an external program and display the output Denke mal so...
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren
Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde Dich hier an.
Jetzt anmelden