How to use placeholders with the translate Adapter?

Hello,

I'm trying to use the \Phalcon\Translate\Adapter\NativeArray with placeholders like in this simple example:

$t = new \Phalcon\Translate\Adapter\NativeArray(['content' => ['test' => 'Hello #name#!']]);
var_export($t->_('test', ['name' => 'John Doe']));

But the translated string is Hello #name#! and not as expected Hello John Doe! .

According to the abstract Adapter all strings sourrounded with # should be repalceable.

What am I doing wrong?



34.0k
edited May '15
Use: %name%
let translation = str_replace("%" . key . "%", value, translation);