Jump to content

Translations in a module controller


Finality

Recommended Posts

Hi !

 

I'm trying to create an admin controller for my module. This is the code of my controller :

<?php
class AdminFCNewsController extends ModuleAdminController {
 
    public function __construct() {
 
        $this->table     = 'fcnews';
        $this->className     = 'FCNewsModel';
		$this->bootstrap = true;
 
        parent :: __construct();
		
		$this->fields_list = array(
			'id_fcnews' => array(
					'title' => '#',
			),
			'title' => array(
					'title'  => $this->module->l('Title'),
			),
			'active' => array (
				'title'  => $this->module->l('Active'),
				'type' => 'bool',
				'active' => 'status' 
			)
		);
		
		
		$this->simple_header = true;
		$this->actions = array('edit', 'delete'); 
    }
	
	public function renderForm()
	{
		if (!($obj = $this->loadObject(true)))
		return;
		
		if (Tools::isSubmit('id_interswitch_data'))
		{
			$interswitch_data = new InterswitchData((int)Tools::getValue('id_interswitch_data'));
			$parent = $shop->id_interswitch_data;
		}
		
		//die($this->module->{l s='Title'});
	 
		$this->fields_form = array(
			'tinymce' => true,
			'legend' => array(
				'title' => $this->l('Add news'),
				'image' => '../img/admin/cog.gif'
				),
			'input' => array(
				array(
				'type' => 'text',
				'label' => $this->l('Title'),
				'name' => 'title',
				'size' => 40
				),
				
				array(
				'type' => 'radio',
				'label' => $this->l('Active'),
				'name' => 'active',
				'is_bool'   => true,
				'required'  => true,
				'values'    => array(
					array(
					  'id'    => 'active_on',
					  'value' => 1,
					  'label' => $this->l('Enabled')
					),
					array(
					  'id'    => 'active_off',
					  'value' => 0,
					  'label' => $this->l('Disabled')
					)
				)),
				
				array(
				'type' => 'textarea',
				'label' => $this->l('News'),
				'name' => 'news',
				'autoload_rte' => true
				),
				
				
			),
			'submit' => array(
				'title' => $this->l('Save')
			)
		);		 
		 
		return parent::renderForm();
	}
 
}
?>

In the renderForm method, I use $this->l(). When I want to translate this texts, I go on the translations tool :

http://img15.hostingpics.net/pics/131905Capture.png

http://img15.hostingpics.net/pics/145516Capture.png

 

But when i'm going on the form, texts are not translated : http://img15.hostingpics.net/pics/218163Capture.png Is it normal ?

 

Thanx for your help :!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...