Zum Inhalt springen

php: sprache für GETTEXT ermitteln


Empfohlene Beiträge

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:

Link zu diesem Kommentar
Auf anderen Seiten teilen

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.

Link zu diesem Kommentar
Auf anderen Seiten teilen

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung wiederherstellen

  Nur 75 Emojis sind erlaubt.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Editor leeren

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...