Closed divix1988 closed 5 years ago
I just ran into the same issue !
It's apparently impossible to use .ini
files to store the translation ; or at least I didn't find a way to make it work and couldn't find documentation about this anywhere.
Is it worth create a PR ?
@jbelien Please check this preview: https://froschdesign.github.io/zend-documentation-showcase/translator/format-examples/#ini
Awesome! That's exactly the documentation I was looking for! 🎉
Thanks :)
@jbelien Can you give me feedback if it works as described?
Confirmed! 🍾
Both normal syntax and simple syntax work!
Sections like Application
from the initial post are not supported. Only translation
and plural
are allowed.
At the moment there are no plans to change this. Maybe later, after the migration to Laminas.
I will close this issue here.
Sorry for the late response.
pl_PL.ini file:
Config:
Usage: (view)
<?= $this->translate('abc') ?>
Error: Each INI row must be an array with message and translation
Contents of $list var from Zend\I18n\Translator\Loader\Ini.php line: 51
Array ( [Application] => Array ( [abc] => translator works )
My main question is: Why the heck does the Ini.php class expects format of 2 values in array like: Array('key', 'value'), where as the correct format is returned by IniReader like Array([key] => value) ??
Either IniReader should output correct format or Ini.php should cope with that format. Anyway the fix which I am curretly using is to put the following two lines inside foreach loop like so:
This would ensure that proper IniReader output is reformated to "proper" acceptable format of Ini.php class. Yet, I would call it a HACK, not a fix.