any suggestions for template translator???

Notice: This thread is very old.
alnux
Member | 105
+
0
-

How can i set templates views according to the language that is use on the client browser.

my folders structure is

templates
	es
	  HomePage
	  Paises
	en
	  HomePage
	  Paises
	cz
	  HomePage
	  Paises

I know that i can use NetteTranslator scrpipt with help of httpRequest service, but there are images or large paragraphs that is much better had on views that in a translator file.

Thanks for the help

Tomáš Votruba
Moderator | 1110
+
0
-

Just overload formatTemplateFiles in your BasePresenter.

Into sth like this:

public function formatTemplateFiles()
{
	$files = parent::formatTemplateFiles()
	$lang = $this->getLang();

	$name = $this->getName();
	$presenter = substr($name, strrpos(':' . $name, ':'));
	$dir = dirname($this->getReflection()->getFileName());
	$dir = is_dir("$dir/templates") ? $dir : dirname($dir);

	$files[] = "$dir/templates/$lang/$presenter/$this->view.latte";

	return $files;
}
alnux
Member | 105
+
0
-

Really thanks Tomas