This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:dev:284:translate [14.08.2015 06:14] – [Wie verarbeitet Translate jetzt diese Informationen?] translated mrbaseman | en:dev:284:translate [14.08.2015 06:44] – finished translation and removed fixme mrbaseman | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
- | |||
====== Centralized management of translations ====== | ====== Centralized management of translations ====== | ||
**Translate** is a package consisting of several classes, that already in WB 2.8.4 take care about all the handling of translations known as ' | **Translate** is a package consisting of several classes, that already in WB 2.8.4 take care about all the handling of translations known as ' | ||
Line 50: | Line 48: | ||
Exactly as just described for the central translation table, it also happens the same way for each individual module and its template which ships with language files and actually loads and uses them. | Exactly as just described for the central translation table, it also happens the same way for each individual module and its template which ships with language files and actually loads and uses them. | ||
- | ==== Wie wird Translate | + | ==== How to use Translate ==== |
- | + | ||
- | Für Addon-Entwickler ist Translate sehr einfach einzusetzen. Die Grundinitialisierung wird **immer** automatisch vom Core vorgenommen und Addons haben damit überhaupt nichts zu schaffen. Bei älteren Addons, die noch PHP-Dateien enthalten, die direkt von außen aufgerufen werden müssen, sind 2 bis maximal 4 Translate-Methoden erforderlich (alle Kommandos werden in der Standalone-Form angegeben). Bedingung für den Einsatz von Translate ist, dass die Datei '' | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | * < | + | |
- | Einfacher noch geht es bei Addon-Dateien, | + | |
- | + | ||
- | Jetzt müssen eigentlich nur noch die Übersetzungstexte von Translate abgerufen werden. Der einfachste Weg ist:\\ | + | |
- | <php> $sText = Translate:: | + | |
- | + | ||
- | Für ältere Addons existiert vorübergehend eine Methode, sämtliche Übersetzungstexte in einem Zug an die // | + | |
- | <php> $template-> | + | |
- | Das Problem bei dieser Methode ist, dass immer eine komplette Kopie der Übersetzungstabelle an die Templateengine übergeben wird. | + | |
- | + | ||
- | Wesentlich einfacher und platzsparender ist die Verwendung in Verbindung mit Twig, da hier nur eine speichersparende Referenz auf das Translateobjekt übergeben wird:\\ | + | |
- | <php> $aTwigData[' | + | |
+ | For Addon developers Translate is very easy to use. The basic initialization is done automatically **always** from Core and therefore Addons don't have to care at all about this mechanism. In older addons that contain PHP files that need to be called directly from the outside, 2 to a maximum of 4 Translate methods need to be called (all commands are given in the form of standalone). Condition for the use of Translate is that the file '' | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | Even simpler with add-on files that are called Core-controlled: | ||
+ | Now basically the only thing left is actually to call the translated texts by Translate. The easiest way is: \\ | ||
+ | <php> $sText = Translate:: | ||
+ | Temporarily for older Addons a method exists that allows to pass all translation texts in one rushto the // | ||
+ | <php> $template-> | ||
+ | The problem with this method is that always a complete copy of the translation table is passed to the Template Engine. | ||
+ | Much easier and less space is used in conjunction with Twig, since only a memory-saving reference is passed to the Translate object:\\ | ||
+ | <php> $aTwigData[' | ||