Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:entwickler:mehrsprachigkeit [2015/12/12 10:24] – [Using in source code] fasseen:entwickler:mehrsprachigkeit [2018/06/17 07:47] (current) – [Using in source code] fasse
Line 3: Line 3:
  
 ==== Using in source code ==== ==== Using in source code ====
-In the **common.php** a global object **gL10n** of the Class **Language** is applied, which is derived of the PHP class [[http://php.net/manual/en/class.simplexmlelement.php|SimpleXMLElement]]. This object reads the XML file. About the method **get ($text_id, $var1 "", $var2 = "")** the search text can be handed over with the ID. It returns then the text in the set language respectively. Does the text have placeholders (#VAR1#, #VAR2# ...), so this can be passed as additional parameters.+In the **common.php** a global object **gL10n** of the Class **Language** is applied, which is derived of the PHP class [[https://secure.php.net/manual/en/class.simplexmlelement.php|SimpleXMLElement]]. This object reads the XML file. About the method **get($textId, $params array())** the search text can be handed over with the ID. It returns then the text in the set language respectively. Does the text have placeholders (#VAR1#, #VAR2# ...), so this can be passed as additional parameters.
  
 Example: Example:
Line 23: Line 23:
  
 ==== Rules for the name ==== ==== Rules for the name ====
-The **name** should always be written capitalized and isolated with underscore to each word. It starts with a //3-digit abbreviation of range/module//. This should be modeled on the symbol of the database tables. Then the English word should be namend. English, therefore, that it is easier for translators who are not proficient in German, to identify the right texts. After the symbol then the content of the text should be summarized as short as possible, so that you know about what it is, when you see only the **name**. It makes sense ta add also verbs to the end to group texts by sections, e.g. **PRO_PHR_PHOTO_SAVED PRO_PHR_PHOTO_DELETED**. Help for correct translation of the German word into English **name** can be found at [[http://translate.google.de |Google Translator]] or [[http://dict.leo.org|Leo]].+The **name** should always be written capitalized and isolated with underscore to each word. It starts with a //3-digit abbreviation// of system //SYS//. You should not use the abbreviation of the modules anymore. English, therefore, that it is easier for translators who are not proficient in German, to identify the right texts. After the symbol then the content of the text should be summarized as short as possible, so that you know about what it is, when you see only the **name**. It makes sense to add also verbs to the end to group texts by sections, e.g. **PRO_PHR_PHOTO_SAVED PRO_PHR_PHOTO_DELETED**. Help for correct translation of the German word into English **name** can be found at [[https://translate.google.com |Google Translator]] or [[https://dict.leo.org|Leo]].
  
 Examples: Examples:
-<code>ANN_ANNOUNCEMENT</code> represents //Announcement//+<code>SYS_ANNOUNCEMENT</code> represents //Announcement//
 <code>SYS_NO_ENTRY</code> represents //The requested item does not exist in the database.// <code>SYS_NO_ENTRY</code> represents //The requested item does not exist in the database.//
-<code>PRO_PHOTO_DELETED</code> represents //The profile photo has been deleted.//+<code>SYS_PHOTO_DELETED</code> represents //The profile photo has been deleted.//
  
 ==== Design options in the text ==== ==== Design options in the text ====
-In translatable text placeholders can be defined that can be filled in later recall of the text with variable content. Placeholders are defined as **#VAR1#**,  **#VAR2#**, etc. Calling the **get** - method they are passed successively. If not all or none are required, then the getter becomes simply passed fewer arguments.  +In translatable text placeholders can be defined that can be filled in later recall of the text with variable content. Placeholders are defined as **#VAR1#**,  **#VAR2#**, etc. Calling the **get** - method they are passed successively within an array in the second parameter. If not all or none are required, then the getter becomes simply passed fewer arguments.  
-<code php>$gL10n->get('SYS_BEISPIEL', 'Text for VAR1', $content_var2, 'VAR3'. $content); </code>+<code php>$gL10n->get('SYS_EXAMPLE', array('Text for VAR1', $content_var2, 'VAR3'. $content)); </code>
 If the contents of a placeholder are issued **bold**, this is possible in the text with the addition **_ BOLD**  to the variable name **#VAR1_BOLD#**. If the contents of a placeholder are issued **bold**, this is possible in the text with the addition **_ BOLD**  to the variable name **#VAR1_BOLD#**.
  
  • en/entwickler/mehrsprachigkeit.1449912250.txt.gz
  • Last modified: 2015/12/12 10:24
  • by fasse