zend framework - Design pattern of translations files -
i'm developping international website based on php zendframework 1.12
,
, i'm going use zend_translate
managing translations.
my translations put php array key=>value
: (one file per language)
<?php return array( 'key' => 'translation', 'key2' => 'translation2', );
my question :
what best way manage keys files?
my opinion :
in first hand, use default language keys. :
'submit' => 'valider', 'share' => 'partager', //...
in other hand, use special keys able directly found text appear :
'label_loginform_login' => 'login', 'button_mixed_submit' => 'submit', 'links_mixed_share' => 'share', //...
but in option, best tree use keys?
how many levels ('type' / 'placement' / 'action' ...)?
and each level, how many items?
example level 'type'
- label : used standard text
- text : used long label multiple sentances
- links : used links label
- button : used buttons label
- mixed : used few things
...
for information, i'm going make module translation.
done using database, , php arrays created automatically perf issue.
for me, prefer second option two reasons.
1- keeping in mind you'll translating validators error messages (which keyed in way regexnotmatch
), second option homogeneous set keys.
2- also, option, avoid having long phrases
keys. example :
return array( 'confirmation_mail_sent' => 'message here' ); return array( 'your validation email has been sent. please click on link , ... bla bla bla bla' => 'message here' );
as can notice, first example more readable second one.
hope opinion clear enough.
thanks
Comments
Post a Comment