Hello,
I'm trying to make a multilingual site but i'm having problems using multidimensional arrays in the language file.
This is in my DI:
$di->setShared('trans', function() use($di) {
require APP_DIR . "/lang/en.php";
return new \Phalcon\Translate\Adapter\NativeArray(array(
"content" => $t
));
});
this is app/lang/en.php
<?php
$t = array(
"hi" => "Hello",
"bye" => "Good Bye",
"test" => array('AA' => 'Option A', 'BB' => 'Option B')
);
Now, when i do
var_dump($this->trans);
I get
object(Phalcon\Translate\Adapter\NativeArray)[69]
protected '_interpolator' =>
object(Phalcon\Translate\Interpolator\AssociativeArray)[70]
protected '_translate' =>
array (size=3)
'hi' => string 'Hello' (length=5)
'bye' => string 'Good Bye' (length=8)
'test' =>
array (size=2)
'AA' => string 'Option A' (length=8)
'BB' => string 'Option B' (length=8)
Everything looking fine. I can also access each key in the array, e.g. var_dump($this->trans['hi']
results in string 'Hello' (length=5)
But when i try to access the test array, e.g. by writing var_dump($this->trans['test']);
i always get
Parameter 'translation' must be a string
Is there any way i can access this array?
Thank you