Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Is good practice translate strings in the template?

Is good practice translate strings in the view(template)? What do you think?

<h1> {{ _('title') }}</h1>

I think we should move on to the template, translated variables.

Well - if they are gonna be used in many places then it's great idea. If not it's still good because you can have all strings in one file, and you don't have to look for something, just remember the key.

I think it's best to use gettext, for performance and ease translate chains.

A DB approach would kill the application, using Array is hard to maintain.

I have seen the code drupal 8 and the views there over 8000 {% trans%}. GettextPHP use a component, if resource-intensive only translate strings.


But phalcon translate can actually use gettext so no problem here :)

Missing doc. :)

but work fine.

$translator = new \Phalcon\Translate\Adapter\Gettext([
                'category'      => $this->category,
                'locale'        => $this->locale . '.utf8',
                'defaultDomain' => $this->defaultDomain,
                'directory'     => $this->directory 

$translator->query('All work fine!');