[TUT]Language-system

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • [TUT]Language-system

      the languages can be found in 'languages/xx/'

      Source Code

      1. ADMIN.php -> as the name says, here you find the $LNG definitions of the adminpanel
      2. BANNER.php -> this one is for building the playerbanner
      3. CUSTOM.php -> here you can define custom $LNG definitones
      4. FAQ.php -> here the texts for the FAQ are stored
      5. FLEET.php -> here you find fleetrelated language content, exept the fleetnames itself
      6. INGAME.php -> here you find the gamecontent
      7. INSTALL.php -> only for installation
      8. L18N.php -> languagefile for tim and dates
      9. PUBLIC.php -> here are parts, wich can be used in the login
      10. TECH.php -> here are the sub arrays
      11. shortNames - untinames for battlereports -example: $LNG['shortNames']['1']
      12. bonus - names of possible bonuses -example: $LNG['bonus']['Defensive']
      13. tech - all gameelements by id -example: $LNG['tech']['1']
      14. shortDescription - all gameelements by id -example: $LNG['shortDescription']['1']
      15. longDescription - all gameelements by id -example: $LNG['longDescription']['1']
      Display All

      in 'languages/xx/templates/'
      here are the rules and emailtexts, as some texts for installation.


      in smarty-template(for all *.tpl files) the syntax for using the $LNG variable in tpl files

      Smarty-Template

      1. {$LNG['tech'][202]} value would be: 'light cargo'
      2. {$LNG['shortNames'][202]} value would be: light cargo'
      3. {$LNG['shortDescription'][202]} value would be: 'The light cargo is an agile ship which can quickly transport resources to other planets.'
      4. {$LNG['longDescription'][202]} value would be: ''The light cargo is an agile ship which can quickly transport resources to other planets.'


      in php you first have to call the $LNG array with '
      (for all the includes/pages/*.php files)

      PHP Source Code

      1. global $LNG;
      ' in the beginning of the script
      afterwards you can use it like this

      PHP Source Code

      1. $LNG['tech'][202] value would be:'light cargo'
      2. $LNG['shortNames'][202] value would be:'light cargo'
      3. $LNG['shortDescription'][202] value would be:'The light cargo is an agile ship which can quickly transport resources to other planets.'
      4. $LNG['longDescription'][202] value would be:'The light cargo is an agile ship which can quickly transport resources to other planets.'

      if you define new languagevariables, think about doing it for all languages. a new definition could look like this

      Smarty-Template

      1. $LNG['NEW_ELEMENT'] = 'This is a new element.'
      2. now it could be used as
      3. $LNG['NEW_ELEMENT'] in the php files
      4. or
      5. {$LNG['NEW_ELEMENT']} in the tpl files

      hope it is a bit more clear, how to use the languagearray. if you ever encounter an error called undefinerd index: $LNG['xxx'] it is a missing definition in the languagefiles.