Changeset 214


Ignore:
Timestamp:
07/16/09 14:32:27 (8 years ago)
Author:
sander
Message:

Add i18n language switching code and flag images

Location:
trunk/server/www/app
Files:
251 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/www/app/app_controller.php

    r135 r214  
    1414         * @var $components array Array of components to load for every controller in the application 
    1515         */ 
    16         public $components = array('AuthCert'); 
     16        public $components = array('AuthCert', 'Session', 'Cookie'); 
    1717 
    1818        /** 
     
    158158                return false; 
    159159        } 
     160 
     161        /** 
     162         * Set the language based on the session or a cookie 
     163         */ 
     164        private function __setLanguage() 
     165        { 
     166                if ($this->Cookie->read('lang') && !$this->Session->check('Config.language')) { 
     167                        $this->Session->write('Config.language', $this->Cookie->read('lang')); 
     168                } 
     169        } 
    160170} 
    161171 
  • trunk/server/www/app/config/routes.php

    r84 r214  
    3030         
    3131/** 
     32 * Connect the 'Lang' controller's urls. 
     33 */ 
     34Router::connect('/lang/*', array('controller' => 'lang', 'action' => 'index')); 
     35         
     36/** 
    3237 * Connect the XMLRPC controller properly to the index action. Everything after xmlrpc/ will be passed 
    3338 * to the index() action as a parameter. This way a user can browser the API interactively. 
  • trunk/server/www/app/views/layouts/default.ctp

    r149 r214  
    4949        <div id="container"> 
    5050                <div id="header"> 
     51                        <div id="lang-select"> 
     52                                <?php echo $html->image('flags/gb.png', array('alt' => 'English', 'title' => 'English', 'url' => '/lang/eng'));?> 
     53                                <?php echo $html->image('flags/nl.png', array('alt' => 'Nederlands', 'url' => '/lang/nld'));?> 
     54                        </div> 
    5155                        <h1><?php echo $html->image('officeshots-logo.png', array('alt' => __('Officeshots.org: Test ODF compatibility', true), 'url' => '/')); ?></h1> 
    5256                        <p> 
  • trunk/server/www/app/webroot/css/cake.override.css

    r154 r214  
    3535 
    3636ul, ol { margin: 1em 0 0 4em; } 
     37 
     38#lang-select { 
     39        width: 50%; 
     40        text-align: right; 
     41        float: right; 
     42} 
     43 
     44#lang-select img { 
     45        border: 1px solid #fff; 
     46} 
Note: See TracChangeset for help on using the changeset viewer.