/** * Creates the language prefixes wich allows us * to use the short :action and :controller translations * * @param string $action * @return void */ protected function set_language_alias($action) { // create langugage aliases $name = explode('::', $this->name); if (isset($name[1])) { $prefix = $name[0] . '::'; $name = $name[1]; } else { $prefix = ''; $name = $name[0]; } if (empty($action)) { $action = static::$_default_action; } CCLang::alias(':controller', $prefix . 'controller/' . strtolower($name)); CCLang::alias(':action', $prefix . 'controller/' . strtolower($name . '.' . $action)); }
/** * CCLang::alias tests */ public function test_alias() { CCLang::set_current('en'); CCLang::alias(':test', 'CCUnit::phpunit'); $this->assertEquals('Welcome', __(':test.welcome')); $this->assertEquals('Hello John', __(':test.hello', array('name' => 'John'))); }