User Tools

Site Tools


en:dev:284:translate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:dev:284:translate [14.08.2015 06:34] – [Wie wird Translate benutzt?] translated first half mrbasemanen:dev:284:translate [18.07.2018 11:09] – [Structure of translation tables] Manuela v.d.Decken
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 'language files' up to now. **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 'language files' up to now.
Line 36: Line 34:
  
 When you look at the table on the left (Extract from the Language support of Firefox), you can already see various Chinese, several German and English language in several dialects. The previously used, simple 2-letter codes purely following [[http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|ISO 639-1]] no longer satisfy at least the most languages with their major, regional to define variations. The use of [[http://en.wikipedia.org/wiki/IETF_language_tag|IETF language tag]] according to [[http://tools.ietf.org/html/rfc5646|RFC 5646]] has therefore in the meantime become to an established standard.  //**Translate**// supports at least the major part of the IETF tags. Not supported are currently the optional //script subtags//, //extension subtags//, and the //private-use subtag//.\\ When you look at the table on the left (Extract from the Language support of Firefox), you can already see various Chinese, several German and English language in several dialects. The previously used, simple 2-letter codes purely following [[http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|ISO 639-1]] no longer satisfy at least the most languages with their major, regional to define variations. The use of [[http://en.wikipedia.org/wiki/IETF_language_tag|IETF language tag]] according to [[http://tools.ietf.org/html/rfc5646|RFC 5646]] has therefore in the meantime become to an established standard.  //**Translate**// supports at least the major part of the IETF tags. Not supported are currently the optional //script subtags//, //extension subtags//, and the //private-use subtag//.\\
-{{ :dev:284:translate:translatemixing.gif?nolink|}}+{{ :dev:284:translate:translatemixing.png?nolink|}}
 //**Translate**// itself currently includes the following tags: //**Translate**// itself currently includes the following tags:
   * //**Primary language subtag**// based on [[http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|ISO-639-1/639-2T/639-3]]   * //**Primary language subtag**// based on [[http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|ISO-639-1/639-2T/639-3]]
Line 59: Line 57:
 Even simpler with add-on files that are called Core-controlled: Here the addon is already activated from the Core. Only the template and/or the theme must still be activated by the addon itself. The deactivation is performed automatically by the core. Even simpler with add-on files that are called Core-controlled: Here the addon is already activated from the Core. Only the template and/or the theme must still be activated by the addon itself. The deactivation is performed automatically by the core.
  
-Jetzt müssen eigentlich nur noch die Übersetzungstexte von Translate abgerufen werdenDer einfachste Weg ist:\\ +Now basically the only thing left is actually to call the translated texts by Translate. The easiest way is: \\ 
-<php> $sText = Translate::getInstance()->TEXT_CANCEL; </php> (entspricht dem früheren <php> $sText = $GLOBALS['TEXT']['CANCEL']; </php>) +<php> $sText = Translate::getInstance()->TEXT_CANCEL; </php>  (corresponds to the former <php> $sText = $GLOBALS['TEXT']['CANCEL']; </php>)
- +
-Für ältere Addons existiert vorübergehend eine Methode, sämtliche Übersetzungstexte in einem Zug an die //**phplib**// Templateengine zu übergeben:\\ +
-<php> $template->set_var(Translate::getInstance()->getLangArray()); </php> eingebunden werden die Texte im Template mit ''{TEXT_CANCEL}''.  +
-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['Trans'] = Translate::getInstance(); </php> die Anzeige im Template erfolgt durch ''%%{{ Trans.TEXT_CANCEL }}%%'' +
- +
  
 +Temporarily for older Addons a method exists that allows to pass all translation texts in one rushto the //**phplib**// Template Engine:\\
 +<php> $template->set_var(Translate::getInstance()->getLangArray()); </php> in the template the texts are inserted with ''{TEXT_CANCEL}''.
 +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['Trans'] = Translate::getInstance(); </php> - in order to display it in the template use ''%%{{ Trans.TEXT_CANCEL }}%%''
  
en/dev/284/translate.txt · Last modified: 18.07.2018 12:46 by Manuela v.d.Decken