Jump to content

Translation for external php files in custom module


Recommended Posts

Hi,

 

I customize my prestashop website with my own module so most of the content comes from this module.

I added a language and manage to get translations using the l method. ( $this->l('my sentence') ).

 

My problem is that I update some of my content using ajax, which is called in a external file in my module.

I was wondering if it was possible to somehow use the same method on the sentences in this file.

 

Thank you.

 

Regards,

Swansong

Link to comment
Share on other sites

If i understood correctly, i should do something like this in mymodule.php

class MyModule extends Module
{
	public function __construct()
	{
		$this->name = 'myModule';
		$this->tab = 'front_office_features';
		$this->version = 1.0;
		$this->author = '...';

		parent::__construct();

		$this->displayName = $this->l('MyModule');
		$this->description = $this->l('Module Description');

                $this->l('sentence i want to translate', 'myModule');
	}
}

and what should i do in my other file, assuming it looks somethink like this

echo 'sentence i want to translate';

Thank you for your time.

 

Swansong

Edited by swansong (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...