We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How can I use CSV Translate Adapter?

I'm finding nothing information about it (on this forum and in other places). And I couldn't fully undestand the source code correctly, to be able to find to find a solution by myself... And...I hope for your help :) Thank you!



77.7k
Accepted
answer
$translate = new Phalcon\Translate\Adapter\Csv([
    'file' => 'fr_FR.csv', // required
    'delimiter' => ',', // optional, default - ;
    'length' => '4096', // optional, default - 0
    'enclosure' => '^', // optional, default - "
]);

echo $translate->_('Hello');
echo $translate->_('My name is %name%', array('name' => 'John Doe')); //Je m'appelle John Doe