Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php: sprache für GETTEXT ermitteln

Empfohlene Antworten

Veröffentlicht

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.:rolleyes:

Und kann ich irgendwo herausfinden, in welchem Ordner PHP die Übersetzungsdateien (.mo-Dateien) sucht?

RTFM?

PHP: Introduction - Manual

Was ist RTFM und wie nutze ich das?

Ist das eine PHP funktion?

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.

Ist das eine PHP funktion?

Nein.

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).

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.

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.

system

(PHP 4, PHP 5)

system — Execute an external program and display the output

Denke mal so...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.