Advertisement
Guest User

Appcontroller

a guest
Jan 24th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <?php
  2.  
  3. App::uses('Controller', 'Controller');
  4. App::import('I18n', 'l10n');
  5.  
  6. class AppController extends Controller {
  7.  
  8.     public $helpers = array('Html', 'Form');
  9.  
  10.     public function getLanguage() {
  11.  
  12.         return Configure::read('Config.language');
  13.  
  14.     }
  15.  
  16.     public function _setFrench() {
  17.  
  18.         Configure::write('Config.language', "fra");
  19.  
  20.         $this -> Session -> write('Config.language', 'fra');
  21.  
  22.         $this -> set('lang', $this -> getLanguage());
  23.  
  24.     }
  25.  
  26.     public function beforeFilter() {
  27.        
  28.         $this -> L10n = new L10n();
  29.    
  30.         $this -> L10n -> languagePath = array('fra');
  31.         $this -> L10n -> locale = 'fra';
  32.        
  33.         $setting = $this -> L10n -> get("fra");
  34.         $this -> L10n -> get();
  35.        
  36.         $this -> set('domain', 'default');
  37.  
  38.        
  39.         Configure::write('Config.language', "fra");
  40.  
  41.         $this -> Session -> write('Config.language', 'fra');
  42.  
  43.  
  44.         $this -> set('lang', $this -> getLanguage());
  45.  
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement