PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Creating INI source files

INI source files are human readable but normally not very small as they also include other data beside translations. If you have data which shall be editable by your customers you can use the INI adapter.

Example 968. Example INI file

[Test]
;TestPage Comment
Message_1="Nachricht 1 (de)"
Message_2="Nachricht 2 (de)"
Message_3="Nachricht :3 (de)"
<?php
$translate 
= new Zend_Translate(
    array(
        
'adapter' => 'ini',
        
'content' => '/path/to/mytranslation.ini',
        
'locale'  => 'de'
    
)
);
$translate->addTranslation(
    array(
        
'content' => '/path/to/other.ini',
        
'locale' => 'it'
    
)
);

INI files have several restrictions. If a value in the INI file contains any non-alphanumeric characters it needs to be enclosed in double-quotes ("). There are also reserved words which must not be used as keys for INI files. These include: NULL, yes, no, TRUE, and FALSE. Values NULL, no and FALSE results in "", yes and TRUE results in '1'. Characters {}|&~![()" must not be used anywhere in the key and have a special meaning in the value. Do not use them as it will produce unexpected behaviour.

Zend Framework