May I ask an another help?
Sure! )))
how to use the translater in the model?
You may use as in a controller
In my projects, I use an another method. I have created a global function that takes string for the translte, an array for replace, and the path to the translation file (optional). It's more easy and faster - one file parsed once and save to global variable. May be it's not OOP style but it's useful for multimodule application too.
<?php
$g_translation_files = [];
function __($str, $placeholders = null, $file = null)
{
global $g_translation_files;
// CCheck is $file in $g_translation_files - this means that file was loaded
// else load file with phalcon adapter to $g_translation_files[$file]
// If $file is not null call function _ $g_translation_files[$file] item and return
// Example:
return $g_translation_files[$file]->_($str, $placeholders);
// If $file is null call function _ for all $g_translation_files items
// Some like below
foreach ($g_translation_files as $translation_file)
{
$tmp_str = $translation_file->_($str, $placeholders)
if ($tmp_str != $str)
{
$str = $tmp_str;
break;
}
}
return $str;
}