Framework Structure - Messages
Framework messages feature allow to implement the i10n (localization) concept. To release this feature the framework stores message files for each language in a special directory, calledmessages
.
These files are the part of framework anf they contain the array of localizable messages and constants. You may modify them by translating the specific messages. In these files each array element represents the translation (value) of a message (key).
Currently they are:
-
framework/ framework directory
-
messages/ directory where placed all message files
-
de directory where message for German language
- core.php core translation in German
-
en directory where message for English language
- core.php core translation in English
-
es directory where message for Spanish language
- core.php core translation in Spanish
...
-
de directory where message for German language
-
messages/ directory where placed all message files
return array ( 'Actions' => 'Actions', 'An error occurred while reading folder {folder}.' => 'An error occurred while reading folder {folder}.', 'Errors' => 'Errors', 'Event is not defined.' => 'Event "{class}.{name}" is not defined.', 'Failed' => 'Failed', 'Success message' => 'New records have been successfully added to the database.', ... );Usage example:
// Will print "Actions" echo A::t('core', 'Actions'); // Will print "Errors" echo A::t('core', 'Errors'); // Will print "New records have been successfully added to the database." echo A::t('core', 'Success message'); // Will replace placeholders {class} and {name} with $className and $eventName print the specified text // Ex.: Event "Customers.create" is not defined. echo A::t('core', 'Event is not defined.', array('{class}'=>$className, '{name}'=>$eventName)); // Will print HTML encodded message "Success &аmp; Lucky" echo A::te('core', 'Success & Lucky');