ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Zend Framework §Ú §Þ§å§Ý§î§ä§Ú§ñ§Ù§í§é§ß§à§ã§ä§î §³§ä§Ö§á§Ñ§ß §´§Ñ§ß§Ñ§ã§Ú§Û§é§å§Ü [email_address] 27 §Þ§Ñ§â§ä§Ñ 2010 §Ô. §³§Ñ§ß§Ü§ä-§±§Ö§ä§Ö§â§Ò§å§â§Ô
§¹§Ö§Þ §ñ §Ù§Ñ§ß§Ú§Þ§Ñ§ð§ã§î? Web §â§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§à§Û §Ù§Ñ§ß§ñ§Ý§ã§ñ §Ó 2003 §Ô§à§Õ§å §³ Zend Framework §ß§Ñ§é§Ñ§Ý §â§Ñ§Ò§à§ä§Ñ§ä§î §Ó 2008 §Ô§à§Õ§å §²§å§Ü§à§Ó§à§Ø§å §ã§à§Ò§ã§ä§Ó§Ö§ß§ß§à§Û §Ó§Ö§Ò-§ã§ä§å§Õ§Ú§Ö§Û §ã 2009 §Ô§à§Õ§Ñ §¡§Ü§ä§Ú§Ó§ß§í§Û §å§é§Ñ§ã§ä§ß§Ú§Ü §ã§à§à§Ò§ë§Ö§ã§ä§Ó§Ñ zendframework.ru  §­§ð§Ò§Ý§ð §á§â§Ú§Ü§à§Ý§î§ß§í§Ö §ã§Þ§Ñ§Û§Ý§í :]
§³§à§Õ§Ö§â§Ø§Ñ§ß§Ú§Ö §Õ§à§Ü§Ý§Ñ§Õ§Ñ §±§â§à§ã§ä§Ö§Û§ê§Ö§Ö §á§à§Õ§Ü§Ý§ð§é§Ö§ß§Ú§Ö Zend_Translate §²§Ñ§Ò§à§ä§Ñ §ã view §ç§Ö§Ý§á§Ö§â§à§Þ translate Plural forms §Ú§Ý§Ú §æ§à§â§Þ§í §Þ§ß§à§Ø§Ö§ã§ä§Ó§Ö§ß§ß§à§Ô§à §é§Ú§ã§Ý§Ñ §±§à§é§Ö§Þ§å §ñ §à§ä§Õ§Ñ§ð §á§â§Ö§Õ§á§à§é§ä§Ö§ß§Ú§Ö gettext? §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit §·§Ñ§Ü§Ú §Õ§Ý§ñ §â§Ñ§Ò§à§ä§í §ã gettext §±§Ö§â§Ö§Ó§à§Õ §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §³§â§Ñ§Ó§ß§Ö§ß§Ú§Ö §â§Ñ§Ù§Ý§Ú§é§ß§í§ç §ã§ç§Ö§Þ §á§Ö§â§Ö§Õ§Ñ§é§Ú §ñ§Ù§í§Ü§Ñ §Ó URL Zend_Translate §Ú §Ü§Ö§ê§Ú§â§à§Ó§Ñ§ß§Ú§Ö
§³§Ñ§Þ§í§Û §á§â§à§ã§ä§à§Û §Ó§Ñ§â§Ú§Ñ§ß§ä §á§à§Õ§Ü§Ý§ð§é§Ö§ß§Ú§ñ Zend_Translate §¥§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §Ó application.ini §ã§Ý§Ö§Õ§å§ð§ë§Ú§Ö §ß§Ñ§ã§ä§â§à§Û§Ü§Ú: resources.translate.data =  APPLICATION_PATH "/languages" resources.translate.adapter =  "array" resources.translate.locale =  "auto" resources.translate.options.scan =  "directory" resources.translate.options.disableNotices =  true §²§Ö§Õ§Ñ§Ü§ä§â§Ú§å§Ö§Þ IndexAction() §Ó §Õ§Ö§æ§à§Ý§ä§ß§à§Þ §Ü§à§ß§ä§â§à§Ý§Ý§Ö§â§Ö: ./application/controllers/IndexController.php public function  indexAction() { echo  $this-> view ->translate( 'Hello' ); }
§³§à§Ù§Õ§Ñ§Ö§Þ §æ§Ñ§Û§Ý §á§Ö§â§Ö§Ó§à§Õ§à§Ó §Õ§Ý§ñ §â§å§ã§ã§Ü§à§Ô§à §ñ§Ù§í§Ü§Ñ §³§ä§â§å§Ü§ä§å§â§Ñ §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ languages: ./application/languages/ `-- ru `-- application.php §¶§Ñ§Û§Ý §á§Ö§â§Ö§Ó§à§Õ§à§Ó: ./application/languages/ru/application.php <?php return array ( 'Hello'  =>  '§±§â§Ú§Ó§Ö§ä' , ); §²§Ö§Ù§å§Ý§î§ä§Ñ§ä: §±§â§Ú§Ó§Ö§ä
§±§à§é§Ö§Þ§å ¡±§±§â§Ú§Ó§Ö§ä¡±, §Ñ §ß§Ö ¡±Hello¡±? §±§à§ä§à§Þ§å §é§ä§à §Ó §Þ§à§Ú§ç §ß§Ñ§ã§ä§â§à§Û§Ü§Ñ§ç §Ò§â§Ñ§å§Ù§Ö§â§Ñ §â§å§ã§ã§Ü§Ú§Û §ñ§Ù§í§Ü §á§à §á§â§Ú§à§â§Ú§ä§Ö§ä§å §Ó§í§ê§Ö §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§à§Ô§à:
§°§ä§Õ§Ö§Ý§î§ß§í§Ö §Þ§à§Ø§ß§à §Ó§í§Ó§à§Õ§Ú§ä§î §ã§à§à§Ò§ë§Ö§ß§Ú§ñ §ß§Ñ §å§Ü§Ñ§Ù§Ñ§ß§ß§à§Þ §ñ§Ù§í§Ü§Ö §¥§Ý§ñ §ï§ä§à§Ô§à §ß§å§Ø§ß§à §å§Ü§Ñ§Ù§Ñ§ä§î §ñ§Ù§í§Ü §Ú§Ý§Ú §Ý§à§Ü§Ñ§Ý§î §Ó §á§à§ã§Ý§Ö§Õ§ß§Ö§Þ §Ñ§â§Ô§å§Þ§Ö§ß§ä§Ö view §ç§Ö§Ý§á§Ö§â§Ñ translate(): ./application/controllers/IndexController.php public function  indexAction() { echo  $this-> view ->translate( 'Hello' ,  'en_GB' ); // §Ú§Ý§Ú echo  $this-> view ->translate( 'Hello' ,  'en' ); } §²§Ö§Ù§å§Ý§î§ä§Ñ§ä: Hello §¿§ä§å §Ó§à§Ù§Þ§à§Ø§ß§à§ã§ä§î §å§Õ§à§Ò§ß§à §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ä§î §á§â§Ú §æ§à§â§Þ§Ú§â§à§Ó§Ñ§ß§Ú§Ú §ä§Ö§Ü§ã§ä§à§Ó §Õ§Ý§ñ §Þ§ß§à§Ô§à§ñ§Ù§í§é§ß§à§Û §â§Ñ§ã§ã§í§Ý§Ü§Ú.
Plural forms §Ú§Ý§Ú §æ§à§â§Þ§í §Þ§ß§à§Ø§Ö§ã§ä§Ó§Ö§ß§ß§à§Ô§à §é§Ú§ã§Ý§Ñ §±§à§Õ§Õ§Ö§â§Ø§Ü§Ñ plural forms §Ö§ã§ä§î §Ó §Ñ§Õ§Ñ§á§ä§Ö§â§Ñ§ç: Array Csv Gettext §²§Ñ§Ù§Ò§Ö§â§Ö§Þ §ß§Ñ §á§â§Ú§Þ§Ö§â§Ö: ./application/controllers/IndexController.php public function  indexAction() { echo   $this -> view ->translate( 'Hello' ) .  '! ' ; $count  = 5; echo  sprintf( $this -> view ->translate( array ( '%s day' ,  '%s days' ,  $count )),  $count ) . ' ' .  $this -> view ->translate( 'left before the conference' ); }
Plural Forms (§á§â§à§Õ§à§Ý§Ø§Ö§ß§Ú§Ö) §°§Ò§ß§à§Ó§Ú§Þ §æ§Ñ§Û§Ý §á§Ö§â§Ö§Ó§à§Õ§à§Ó §Õ§Ý§ñ §â§å§ã§ã§Ü§à§Ô§à §ñ§Ù§í§Ü§Ñ: ./application/languages/ru/application.php <?php return   array ( 'Hello'  =>  '§±§â§Ú§Ó§Ö§ä' , 'left before the conference'  =>  '§à§ã§ä§Ñ§Ý§à§ã§î §Õ§à §ß§Ñ§é§Ñ§Ý§Ñ §Ü§à§ß§æ§Ö§â§Ö§ß§è§Ú§Ú' , '%s day'  =>  array ( '%s §Õ§Ö§ß§î' , '%s §Õ§ß§ñ' , '%s §Õ§ß§Ö§Û' ) ); §²§Ö§Ù§å§Ý§î§ä§Ñ§ä: §±§â§Ú§Ó§Ö§ä! 5 §Õ§ß§Ö§Û §à§ã§ä§Ñ§Ý§à§ã§î §Õ§à §ß§Ñ§é§Ñ§Ý§Ñ §Ü§à§ß§æ§Ö§â§Ö§ß§è§Ú§Ú
§±§à§é§Ö§Þ§å §ñ §à§ä§Õ§Ñ§ð §á§â§Ö§Õ§á§à§é§ä§Ö§ß§Ú§Ö gettext? §£ §Ü§à§Õ§Ö §à§ä§à§Ò§â§Ñ§Ø§Ñ§ð§ä§ã§ñ §à§â§Ú§Ô§Ú§ß§Ñ§Ý§í §ã§à§à§Ò§ë§Ö§ß§Ú§Û. §±§â§Ú§Þ§Ö§â §ã§à§à§Ò§ë§Ö§ß§Ú§ñ §Ó view §ê§Ñ§Ò§Ý§à§ß§Ö: <h2> <?php  echo   $this ->translate( 'Create new brand' ); ?>: </h2> §¯§Ö §ß§å§Ø§ß§à §Ú§ã§Ü§Ñ§ä§î §Ô§Õ§Ö §Ú §Ü§Ñ§Ü§Ú§Ö §ã§ä§â§à§Ü§Ú §Ò§í§Ý§Ú §Õ§à§Ò§Ñ§Ó§Ý§Ö§ß§í §Ú§Ý§Ú §å§Õ§Ñ§Ý§Ö§ß§í §Ó §Ú§ã§ç§à§Õ§ß§à§Þ §Ü§à§Õ§Ö ¡ª gettext §ã§Ñ§Þ §ß§Ñ§Û§Õ§Ö§ä §Ó§ã§Ö §Ú§Ù§Þ§Ö§ß§Ö§ß§Ú§ñ.  §¦§ã§ä§î §Ô§à§ä§à§Ó§í§Ö §á§â§à§Ô§â§Ñ§Þ§Þ§í §Õ§Ý§ñ §â§Ñ§Ò§à§ä§í §ã §æ§Ñ§Û§Ý§Ñ§Þ§Ú §á§Ö§â§Ö§Ó§à§Õ§à§Ó (§à§ã§à§Ò§Ö§ß§ß§à §Ñ§Ü§ä§å§Ñ§Ý§î§ß§à §Õ§Ý§ñ §¯§¦§á§â§à§Ô§â§Ñ§Þ§Þ§Ú§ã§ä§à§Ó). §¥§à§ã§ä§Ñ§ä§à§é§ß§à §á§â§Ö§Õ§à§ã§ä§Ñ§Ó§Ú§ä§î §Ù§Ñ§Ü§Ñ§Ù§é§Ú§Ü§å §Ú§Ý§Ú §á§Ö§â§Ó§à§Õ§é§Ú§Ü§å  .po  §æ§Ñ§Û§Ý §Ú §á§â§à§Ô§â§Ñ§Þ§Þ§å §Õ§Ý§ñ §Ö§Ô§à §â§Ö§Õ§Ñ§Ü§ä§Ú§â§à§Ó§Ñ§ß§Ú§ñ (§ß§Ñ§á§â§Ú§Þ§Ö§â §Ü§â§à§ã§ã§á§Ý§Ñ§ä§æ§à§â§Þ§Ö§ß§ß§Ñ§ñ  Poedit ).
§²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit. §¯§Ñ§ã§ä§â§à§Û§Ü§Ú §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ §³§à§Ù§Õ§Ñ§Ö§Þ §ß§à§Ó§í§Û §Ü§Ñ§ä§Ñ§Ý§à§Ô  §¶§Ñ§Û§Ý->§³§à§Ù§Õ§Ñ§ä§î §Ü§Ñ§ä§Ñ§Ý§à§Ô . §µ§Ü§Ñ§Ù§í§Ó§Ñ§Ö§Þ §ß§Ö§à§Ò§ç§à§Õ§Ú§Þ§í§Ö §ß§Ñ§ã§ä§â§à§Û§Ü§Ú:
§²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit. §¯§Ñ§ã§ä§â§à§Û§Ü§Ñ §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ (§á§â§à§Õ§à§Ý§Ø§Ö§ß§Ú§Ö) §°§Ò§ñ§Ù§Ñ§ä§Ö§Ý§î§ß§à §å§Ü§Ñ§Ù§í§Ó§Ñ§Û§ä§Ö §æ§à§â§Þ§í §Þ§ß§à§Ø§Ö§ã§ä§Ó§Ö§ß§ß§à§Ô§à §é§Ú§ã§Ý§Ñ §Õ§Ý§ñ §Ü§Ñ§Ø§Õ§à§Ô§à §á§Ö§â§Ö§Ó§à§Õ§Ñ! §±§à§Ý§ß§í§Û §ã§á§Ú§ã§à§Ü §æ§à§â§Þ §Þ§à§Ø§ß§à §ß§Ñ§Û§ä§Ú §ß§Ñ §ã§ä§â§Ñ§ß§Ú§è§Ö  http://translate.sourceforge.net/wiki/l10n/pluralforms §¯§Ñ§á§â§Ú§Þ§Ö§â  §Õ§Ý§ñ §â§å§ã§ã§Ü§à§Ô§à: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 or n%100>=20) ? 1 : 2)   §Õ§Ý§ñ §ß§Ö§Þ§Ö§è§Ü§à§Ô§à: nplurals=2; plural=(n != 1)
§²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit. §±§å§ä§Ú §¯§Ñ §Ó§Ü§Ý§Ñ§Õ§Ü§Ö ? §±§å§ä§Ú ? §å§Ü§Ñ§Ù§í§Ó§Ñ§Ö§Þ §á§å§ä§î §Ü §Ü§Ñ§ä§Ñ§Ý§à§Ô§å §á§â§à§Ö§Ü§ä§Ñ §Ú§Ý§Ú §á§å§ä§Ú §Ü §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ§Þ §Ü§à§ä§à§â§í§Ö §ß§å§Ø§ß§à §ã§Ü§Ñ§ß§Ú§â§à§Ó§Ñ§ä§î:
§²§Ñ§Ò§à§ä§Ñ§Ö§Þ poedit. §¬§Ý§ð§é§Ö§Ó§í§Ö §ã§Ý§à§Ó§Ñ §´§Ñ§Ü§Ø§Ö §Õ§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §ß§Ñ§Ù§Ó§Ñ§ß§Ú§ñ §æ§å§ß§Ü§è§Ú§Û, §ã§ä§â§à§Ü§à§Ó§í§Ö §Ñ§â§Ô§å§Þ§Ö§ß§ä§í §Ü§à§ä§à§â§í§ç §Õ§à§Ý§Ø§ß§í §Õ§à§Ò§Ñ§Ó§Ý§ñ§ä§ã§ñ §Ó §ñ§Ù§í§Ü§à§Ó§í§Û §æ§Ñ§Û§Ý (§Ó§Ü§Ý§Ñ§Õ§Ü§Ñ ? §¬§Ý§ð§é§Ö§Ó§í§Ö §ã§Ý§à§Ó§Ñ ?):
§¥§Ý§ñ §é§Ö§Ô§à §ñ §Õ§à§Ò§Ñ§Ó§Ú§Ý plural:1,2? §Á  §ß§Ö §Ù§ß§Ñ§ð   §Ü§Ñ§Ü §Ù§Ñ§ã§ä§Ñ§Ó§Ú§ä§î §á§Ñ§â§ã§Ö§â xgettext §Õ§à§ã§ä§Ñ§Ó§Ñ§ä§î §ã§ä§â§à§Ü§Ú §Ú§Ù §ä§Ñ§Ü§à§Û §Ü§à§ß§ã§ä§â§å§Ü§è§Ú§Ú: $this -> view ->translate( array ( '%s day' ,  '%s days' ,  $count ) §¯§à §à§ß §å§ã§á§Ö§ê§ß§à §Õ§à§ã§ä§Ñ§Ö§ä §Ú§ç §Ú§Ù §Ü§à§ß§ã§ä§â§å§Ü§è§Ú§Ú §Ó§Ú§Õ§Ñ: $this -> view ->translate()->getTranslator()->plural( '%s day' ,  '%s days' ,  $count )
§²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã Poedit. §°§Ò§ß§à§Ó§Ý§ñ§Ö§Þ §Ü§Ñ§ä§Ñ§Ý§à§Ô §Ú§Ù §Ú§ã§ç§à§Õ§ß§í§ç §æ§Ñ§Û§Ý§à§Ó §³§à§ç§â§Ñ§ß§ñ§Ö§Þ §Ü§Ñ§ä§Ñ§Ý§à§Ô  ./application/languages/ru/application.po §ª §à§Ò§à§Ó§Ý§ñ§Ö§Þ §Ö§Ô§à  §¬§Ñ§ä§Ñ§Ý§à§Ô->§°§Ò§ß§à§Ó§Ú§ä§î §Ú§Ù §Ú§ã§ç§à§Õ§ß§à§Ô§à §Ü§à§Õ§Ñ §±§à§Ý§å§é§Ñ§Ö§Þ §ã§Ý§Ö§Õ§å§ð§ë§å§ð §Ü§Ñ§â§ä§Ú§ß§å:
§²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã Poedit. §¥§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §á§Ö§â§Ö§Ó§à§Õ§í §Ú §ã§à§ç§â§Ñ§ß§ñ§Ö§Þ §Ü§Ñ§ä§Ñ§Ý§à§Ô §³§à§ç§â§Ñ§ß§ñ§Ö§Þ §â§Ö§Ù§å§Ý§î§ä§Ñ§ä. §£ §á§Ñ§â§Ñ§Þ§Ö§ä§â§Ñ§ç §Õ§à§Ý§Ø§ß§Ñ §Ò§í§ä§î §à§ä§Þ§Ö§é§Ö§ß§Ñ §à§á§è§Ú§ñ ¡±§±§â§Ú §ã§à§ç§â§Ñ§ß§Ö§ß§Ú§Ú §Ñ§Ó§ä§à§Þ§Ñ§ä§Ú§é§Ö§ã§Ü§Ú §Ü§à§Þ§á§Ú§Ý§Ú§â§à§Ó§Ñ§ä§î §æ§Ñ§Û§Ý  .mo ¡±. §£ application.ini §Þ§Ö§ß§ñ§Ö§Þ §Ñ§Õ§Ñ§á§ä§Ö§â §ß§Ñ: resources.translate.adapter = &quot;gettext&quot; §©§Ñ§á§å§ã§Ü§Ñ§Ö§Þ: §±§â§Ú§Ó§Ö§ä! 5 §Õ§ß§Ö§Û §à§ã§ä§Ñ§Ý§à§ã§î §Õ§à §ß§Ñ§é§Ñ§Ý§Ñ §Ü§à§ß§æ§Ö§â§Ö§ß§è§Ú§Ú
§¯§î§ð§Ñ§ß§ã§í §Ú §ç§Ñ§Ü§Ú §Õ§Ý§ñ §â§Ñ§Ò§à§ä§í §ã gettext §­§Ö§Û§Ò§Ý§í §æ§à§â§Þ§í §ß§å§Ø§ß§à §à§Ò§à§â§Ñ§é§Ú§Ó§Ñ§ä§î §Ó _(). §±§â§Ú§Þ§Ö§â: $username  =  $form ->createElement( 'text' ,  'username' ); $username ->setLabel( _( '§ª§Þ§ñ §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§ñ' ) ); §´§à§Ý§î§Ü§à §é§ä§à §á§à§Õ§å§Þ§Ñ§Ý §à §ä§à§Þ, §é§ä§à  setLabel  §ä§à§Ø§Ö §Þ§à§Ø§ß§à §Õ§à§Ò§Ñ§Ó§Ú§ä§î §Ó  §Ü§Ý§ð§é§Ö§Ó§í§Ö §ã§Ý§à§Ó§Ñ  :). §´§Ñ §Ø§Ö §ã§Ú§ä§å§Ñ§è§Ú§ñ §ã §ß§Ñ§Ù§Ó§Ñ§ß§Ú§ñ§Þ§Ú §á§å§ß§Ü§ä§à§Ó §Þ§Ö§ß§ð §Õ§Ý§ñ Zend_Navigation: array ( 'controller'  =>  'users' , 'action'   =>  'list' , 'resource'   =>  'mvc:users' , 'privilege'   =>  'list' , 'label'   =>  _( 'Users' ) , 'route'   =>  'default' , )
§±§Ö§â§Ö§Ó§à§Õ §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §Õ§Ý§ñ §Ñ§Õ§Ñ§á§ä§Ö§â§à§Ó != array §²§Ñ§ß§î§ê§Ö §Þ§í §Õ§Ö§Ý§Ñ§Ý§Ú §à§ä§Õ§Ö§Ý§î§ß§í§Û §æ§Ñ§Û§Ý§Ú§Ü, §Ü§à§ä§à§â§í§Û §ã§à§Õ§Ö§â§Ø§Ñ§Ý §Ó§ã§Ö §ã§à§à§Ò§ë§Ö§ß§Ú§ñ  §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó  §à§Ò§Ö§â§ß§å§ä§í§Ö §Ó _(): _( &quot;A record matching amp;quot;%value%amp;quot; was found&quot; ); _( &quot;Password and confirmed password do not match.&quot; ); xgettext §ï§ä§à§ä §æ§Ñ§Û§Ý §á§Ñ§â§ã§Ú§Ý, §Ñ §Þ§í §á§Ö§â§Ö§Ó§à§Õ§Ú§Ý§Ú §Ú §Ü§à§Þ§á§Ú§Ý§Ú§â§à§Ó§Ñ§Ý§Ú  .mo  §æ§Ñ§Û§Ý, §Ü§à§ä§à§â§í§Û §å§Ø§Ö §á§à§Õ§Ü§Ý§ð§é§Ñ§Ý§Ú §Ü§à §Ó§ã§Ö§Þ §á§â§à§Ö§Ü§ä§Ñ§Þ. §´§Ö§á§Ö§â§î §Ó ZF §á§à§ñ§Ó§Ú§Ý§Ñ§ã§î §á§Ñ§á§à§é§Ü§Ñ  resources , §Ó §Ü§à§ä§à§â§à§Û §Ý§Ö§Ø§Ñ§ä §á§Ö§â§Ö§Ó§à§Õ§í §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó. §¯§à §Ü§Ñ§Ü §Ú§ç§á§à§Õ§Ü§Ý§ð§é§Ú§ä§î §Ö§ã§Ý§Ú §Õ§Ý§ñ §à§ã§ß§à§Ó§ß§à§Ô§à §ã§Ñ§Û§ä§Ñ §Ú§ã§á§à§Ý§î§Ù§å§Ö§ä§ã§ñ §Ñ§Õ§Ñ§á§ä§Ö§â §à§ä§Ý§Ú§é§ß§í§Û §à§ä  array  §ñ §á§à§Ü§Ñ §ß§Ö §â§Ñ§Ù§à§Ò§â§Ñ §Ý§ã§ñ . §¥§å§Þ§Ñ§ð, §é§ä§à §Ó§ã§Ü§à§â§Ö  §â§Ñ§Ù§Ò§Ö§â§å§ã§î  §Ú §â§Ö§ê§Ö§ß§Ú§Ö §Ò§å§Õ§Ö§ä §à§á§å§Ò§Ý§Ú§Ü§à§Ó§Ñ§ß§à §ß§Ñ §ã§Ñ§Û§ä§Ö §Ú§Ý§Ú §æ§à§â§å§Þ§Ö  http://zendframework.ru
§±§Ö§â§Ö§Ó§à§Õ §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §Õ§Ý§ñ §Ñ§Õ§Ñ§á§ä§Ö§â§Ñ array §¥§Ý§ñ  array  §Ó§ã§Ö §ß§Ñ§Þ§ß§à§Ô§à §á§â§à§ë§Ö. §¥§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §Ó Bootstrap.php §ä§Ñ§Ü§à§Û §Þ§Ö§ä§à§Õ: /** * Init translator to Zend_Validate * @return Zend_Translate */ public   function  _initZendValidateTranslator() { $this ->bootstrap( 'translate' ); $translate  =  $this ->getResource( 'translate' ); $translate ->addTranslation(APPLICATION_PATH .  '/../resources/languages' ); return   $translate ; }
§£§Ñ§â§Ú§Ñ§ß§ä§í §á§Ö§â§Ö§Õ§Ñ§é§Ú §ñ§Ù§í§Ü§Ñ §Ó URL §Á§Ù§í§Ü §ß§Ñ §á§à§Õ§Õ§à§Þ§Ö§ß§Ö  ( Zend_Controller_Router_Route_Hostname ) : en.wikipedia.org ru.wikipedia.org §Á§Ù§í§Ü §Ó §á§à§Õ§Õ§Ú§â§Ö§Ü§ä§à§â§Ú§Ú: 1§Û §Ó§Ñ§â§Ú§Ñ§ß§ä ( CyEngine_Controller_Router_Route_Multilingual ): mota.ru   ¨C §â§å§ã§ã§Ü§Ú§Û mota.ru/en/   ¨C §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§Ú§Û 2§Û §Ó§Ñ§â§Ú§Ñ§ß§ä ( §á§Ö§â§Ö§à§á§â§Ö§Õ§Ö§Ý§ñ§Ö§Þ  Zend_Controller_Router_Route ): preorder.it  ¨C ¡±auto¡± §Ú§Ý§Ú §á§à §Ò§Ñ§Ù§Ö GeoIP preorder.it/ru/   ¨C §â§å§ã§ã§Ü§Ú§Û preorder.it/en/   ¨C §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§Ú§Û
§Á§Ù§í§Ü §ß§Ñ §á§à§Õ§Õ§à§Þ§Ö§ß§Ö  +/-  + §µ§ã§Ü§à§â§Ö§ß§ß§Ñ§ñ §Ú§ß§Õ§Ö§Ü§ã§Ñ§è§Ú§ñ. §¥§Ý§ñ §Õ§à§Þ§Ö§ß§à§Ó §á§Ö§â§Ó§à§Ô§à §å§â§à§Ó§ß§ñ, §Ü§à§ä§à§â§í§Ö §ß§Ö §Ú§Þ§Ö§ð§ä §Ô§Ö§à§Ô §â §Ñ§æ§Ú§é§Ö§ã§Ü§à§Û §á§â§Ú§Ó§ñ§Ù§Ü§Ú §Þ§à§Ø§ß§à §ß§Ñ§ã§ä§â§à§Ú§ä§î §â§Ñ§Ù§ß§í§Ö §Ô§Ö§à§Ô§â§Ñ§æ§Ú§é§Ö§ã§Ü§Ú§Ö §è§Ö§Ý§Ú §Õ§Ý§ñ §Ü§Ñ§Ø§Õ§à§Û §ñ§Ù§í§Ü§à§Ó§à§Û §Ó§Ö§â§ã§Ú§Ú §ã§Ñ§Û§ä§Ñ (§Ó Google Webmaster Tools). §£§Ö§ã §ã §à§ã§ß§à§Ó§ß§à§Ô§à §Õ§à§Þ§Ö§ß§Ñ §á§Ö§â§Ö§Õ§Ñ§Ö§ä§ã§ñ §ß§Ñ §á§à§Õ§Õ§à§Þ§Ö§ß§í. §³§Ñ§Û§ä§í §Þ§à§Ø§ß§à §â§Ñ§Ù§ß§Ö§ã§ä§Ú §ß§Ñ §â§Ñ§Ù§ß§í§Ö §ã§Ö§â§Ó§Ö§â§Ñ §Ú §Õ§Ö§Ý§Ñ§ä§î §ß§Ö§Ù§Ñ§Ó§Ú§ã§Ú§Þ§í§Ö §Ú§Ù§Þ§Ö§ß§Ö§ß§Ú§ñ §Ó §Ü§à§Õ§Ö. - §¢§ð§Õ§Ø§Ö§ä §ß§Ñ §á§â§à§Õ§Ó§Ú§Ø§Ö§ß§Ú§Ö §Ú §ï§æ§æ§Ö§Ü§ä §à§ä §ß§Ö§Ô§à §Ò§å§Õ§Ö§ä §Õ§â§à§Ò§Ú§ä§î§ã§ñ §ß§Ñ §Ó§ã§Ö §ã§Ñ§Û§ä§í.
§Á§Ù§í§Ü §Ó §á§à§Õ§Õ§Ú§â§Ö§Ü§ä§à§â§Ú§Ú  +/-  + §¥§à§ã§ä§Ñ§ä§à§é§ß§à §á§â§à§ã§ä§à §â§Ö§Ñ§Ý§Ú§Ù§à§Ó§Ñ§ä§î §Ó ZF. §·§à§â§à§ê§à §á§à§Õ§ç§à§Õ§Ú§ä §Õ§Ý§ñ §ã§Ñ§Û§ä§à§Ó-§å§ã§Ý§å§Ô. §ª§Õ§Ö§ä §á§â§à§Õ§Ó§Ú§Ø§Ö§ß§Ú§ñ §à§Õ§ß§à§Ô§à §Õ§à§Þ§Ö§ß§Ñ, §ä.§Ö. §ä§à§ä §Ø§Ö §Ò§ð§Õ§Ø§Ö§ä §é§ä§à §Ú §Ó §á§Ö§â§Ó§à§Þ §Ó§Ñ§â§Ú§Ñ§ß§ä§Ö §Õ§Ñ§ã§ä §Ò§à§Ý§î§ê§Ú§Û §ï§æ§æ§Ö§Ü§ä. - §¢§à§Ý§Ö§Ö §Þ§Ö§Õ§Ý§Ö§ß§ß§Ñ§ñ §Ú§ß§Õ§Ö§Ü§ã§Ñ§è§Ú§ñ. §¯§Ö§Ý§î§Ù§ñ §ã§Õ§Ö§Ý§Ñ§ä§î §â§Ñ§Ù§ß§í§Ö §Ô§Ö§à§Ô §â §Ñ§æ§Ú§é§Ö§ã§Ü§Ú§Ö §è§Ö§Ý§Ú §Õ§Ý§ñ §â§Ñ§Ù§ß§í§ç §ñ§Ù§í§Ü§à§Ó§í§ç §Ó§Ö§â§ã§Ú§Û §ã§Ñ§Û§ä§Ñ. §³ §ä§Ö§ç§ß§Ú§é§Ö§ã§Ü§à§Û §ã§ä§à§â§à§ß§í §Ò§å§Õ§Ö§ä §á§â§à§Ò§Ý§Ö§Þ§Ñ§ä§Ú§é§ß§à §â§Ñ§Ù§ß§Ö§ã§ä§Ú §â§Ñ§Ù§ß§í§Ö §ñ§Ù§í§Ü§à§Ó§í§Ö §Ó§Ö§â§ã§Ú§Ú §ã§Ñ§Û§ä§Ñ §ß§Ñ §â§Ñ§Ù§ß§í§Ö §ã§Ö§â§Ó§Ö§â§Ñ.
§¯§Ö§ã§Ü§à§Ý§î§Ü§à §ã§ä§â§à§é§Ö§Ü §Ü§à§Õ§Ñ, §Ü§à§ä§à§â§í§Ö §Õ§Ö§Ý§Ñ§ð§ä §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§Ö §Ò§í§ã§ä§â§Ö§Ö :)  §¦§ã§Ý§Ú §Ö§ã§ä§î §Ó§à§Ù§Þ§à§Ø§ß§à§ã§ä§î §é§ä§à-§ä§à §Ù§Ñ§Ü§Ö§ê§Ú§â§à§Ó§Ñ§ä§î, §Ù§ß§Ñ§é§Ú§ä §ß§å§Ø§ß§à §Ö§× §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ä§î: $cache  = Zend_Cache:: factory ( 'Core' , 'File' , array ( 'caching'  =>  true , 'automatic_serialization'  =>  true , 'lifetime'  => 3600, ), array ( 'cache_dir'  => realpath(APPLICATION_PATH .  '/../tmp' ), ) ); Zend_Translate:: setCache ( $cache );
The end  ? §¢§Ý§Ñ§Ô§à§Õ§Ñ§â§ð §Ù§Ñ §Ó§ß§Ú§Þ§Ñ§ß§Ú§Ö! §©§Ñ§Õ§Ñ§Ó§Ñ§Û§ä§Ö §Ó§Ñ§ê§Ú §Ó§à§á§â§à§ã§í ;) §³§ä§Ö§á§Ñ§ß §´§Ñ§ß§Ñ§ã§Ú§Û§é§å§Ü [email_address]

More Related Content

ZFConf 2010: Zend Framework and Multilingual

  • 1. Zend Framework §Ú §Þ§å§Ý§î§ä§Ú§ñ§Ù§í§é§ß§à§ã§ä§î §³§ä§Ö§á§Ñ§ß §´§Ñ§ß§Ñ§ã§Ú§Û§é§å§Ü [email_address] 27 §Þ§Ñ§â§ä§Ñ 2010 §Ô. §³§Ñ§ß§Ü§ä-§±§Ö§ä§Ö§â§Ò§å§â§Ô
  • 2. §¹§Ö§Þ §ñ §Ù§Ñ§ß§Ú§Þ§Ñ§ð§ã§î? Web §â§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§à§Û §Ù§Ñ§ß§ñ§Ý§ã§ñ §Ó 2003 §Ô§à§Õ§å §³ Zend Framework §ß§Ñ§é§Ñ§Ý §â§Ñ§Ò§à§ä§Ñ§ä§î §Ó 2008 §Ô§à§Õ§å §²§å§Ü§à§Ó§à§Ø§å §ã§à§Ò§ã§ä§Ó§Ö§ß§ß§à§Û §Ó§Ö§Ò-§ã§ä§å§Õ§Ú§Ö§Û §ã 2009 §Ô§à§Õ§Ñ §¡§Ü§ä§Ú§Ó§ß§í§Û §å§é§Ñ§ã§ä§ß§Ú§Ü §ã§à§à§Ò§ë§Ö§ã§ä§Ó§Ñ zendframework.ru §­§ð§Ò§Ý§ð §á§â§Ú§Ü§à§Ý§î§ß§í§Ö §ã§Þ§Ñ§Û§Ý§í :]
  • 3. §³§à§Õ§Ö§â§Ø§Ñ§ß§Ú§Ö §Õ§à§Ü§Ý§Ñ§Õ§Ñ §±§â§à§ã§ä§Ö§Û§ê§Ö§Ö §á§à§Õ§Ü§Ý§ð§é§Ö§ß§Ú§Ö Zend_Translate §²§Ñ§Ò§à§ä§Ñ §ã view §ç§Ö§Ý§á§Ö§â§à§Þ translate Plural forms §Ú§Ý§Ú §æ§à§â§Þ§í §Þ§ß§à§Ø§Ö§ã§ä§Ó§Ö§ß§ß§à§Ô§à §é§Ú§ã§Ý§Ñ §±§à§é§Ö§Þ§å §ñ §à§ä§Õ§Ñ§ð §á§â§Ö§Õ§á§à§é§ä§Ö§ß§Ú§Ö gettext? §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit §·§Ñ§Ü§Ú §Õ§Ý§ñ §â§Ñ§Ò§à§ä§í §ã gettext §±§Ö§â§Ö§Ó§à§Õ §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §³§â§Ñ§Ó§ß§Ö§ß§Ú§Ö §â§Ñ§Ù§Ý§Ú§é§ß§í§ç §ã§ç§Ö§Þ §á§Ö§â§Ö§Õ§Ñ§é§Ú §ñ§Ù§í§Ü§Ñ §Ó URL Zend_Translate §Ú §Ü§Ö§ê§Ú§â§à§Ó§Ñ§ß§Ú§Ö
  • 4. §³§Ñ§Þ§í§Û §á§â§à§ã§ä§à§Û §Ó§Ñ§â§Ú§Ñ§ß§ä §á§à§Õ§Ü§Ý§ð§é§Ö§ß§Ú§ñ Zend_Translate §¥§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §Ó application.ini §ã§Ý§Ö§Õ§å§ð§ë§Ú§Ö §ß§Ñ§ã§ä§â§à§Û§Ü§Ú: resources.translate.data = APPLICATION_PATH &quot;/languages&quot; resources.translate.adapter = &quot;array&quot; resources.translate.locale = &quot;auto&quot; resources.translate.options.scan = &quot;directory&quot; resources.translate.options.disableNotices = true §²§Ö§Õ§Ñ§Ü§ä§â§Ú§å§Ö§Þ IndexAction() §Ó §Õ§Ö§æ§à§Ý§ä§ß§à§Þ §Ü§à§ß§ä§â§à§Ý§Ý§Ö§â§Ö: ./application/controllers/IndexController.php public function indexAction() { echo $this-> view ->translate( 'Hello' ); }
  • 5. §³§à§Ù§Õ§Ñ§Ö§Þ §æ§Ñ§Û§Ý §á§Ö§â§Ö§Ó§à§Õ§à§Ó §Õ§Ý§ñ §â§å§ã§ã§Ü§à§Ô§à §ñ§Ù§í§Ü§Ñ §³§ä§â§å§Ü§ä§å§â§Ñ §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ languages: ./application/languages/ `-- ru `-- application.php §¶§Ñ§Û§Ý §á§Ö§â§Ö§Ó§à§Õ§à§Ó: ./application/languages/ru/application.php <?php return array ( 'Hello' => '§±§â§Ú§Ó§Ö§ä' , ); §²§Ö§Ù§å§Ý§î§ä§Ñ§ä: §±§â§Ú§Ó§Ö§ä
  • 6. §±§à§é§Ö§Þ§å ¡±§±§â§Ú§Ó§Ö§ä¡±, §Ñ §ß§Ö ¡±Hello¡±? §±§à§ä§à§Þ§å §é§ä§à §Ó §Þ§à§Ú§ç §ß§Ñ§ã§ä§â§à§Û§Ü§Ñ§ç §Ò§â§Ñ§å§Ù§Ö§â§Ñ §â§å§ã§ã§Ü§Ú§Û §ñ§Ù§í§Ü §á§à §á§â§Ú§à§â§Ú§ä§Ö§ä§å §Ó§í§ê§Ö §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§à§Ô§à:
  • 7. §°§ä§Õ§Ö§Ý§î§ß§í§Ö §Þ§à§Ø§ß§à §Ó§í§Ó§à§Õ§Ú§ä§î §ã§à§à§Ò§ë§Ö§ß§Ú§ñ §ß§Ñ §å§Ü§Ñ§Ù§Ñ§ß§ß§à§Þ §ñ§Ù§í§Ü§Ö §¥§Ý§ñ §ï§ä§à§Ô§à §ß§å§Ø§ß§à §å§Ü§Ñ§Ù§Ñ§ä§î §ñ§Ù§í§Ü §Ú§Ý§Ú §Ý§à§Ü§Ñ§Ý§î §Ó §á§à§ã§Ý§Ö§Õ§ß§Ö§Þ §Ñ§â§Ô§å§Þ§Ö§ß§ä§Ö view §ç§Ö§Ý§á§Ö§â§Ñ translate(): ./application/controllers/IndexController.php public function indexAction() { echo $this-> view ->translate( 'Hello' , 'en_GB' ); // §Ú§Ý§Ú echo $this-> view ->translate( 'Hello' , 'en' ); } §²§Ö§Ù§å§Ý§î§ä§Ñ§ä: Hello §¿§ä§å §Ó§à§Ù§Þ§à§Ø§ß§à§ã§ä§î §å§Õ§à§Ò§ß§à §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ä§î §á§â§Ú §æ§à§â§Þ§Ú§â§à§Ó§Ñ§ß§Ú§Ú §ä§Ö§Ü§ã§ä§à§Ó §Õ§Ý§ñ §Þ§ß§à§Ô§à§ñ§Ù§í§é§ß§à§Û §â§Ñ§ã§ã§í§Ý§Ü§Ú.
  • 8. Plural forms §Ú§Ý§Ú §æ§à§â§Þ§í §Þ§ß§à§Ø§Ö§ã§ä§Ó§Ö§ß§ß§à§Ô§à §é§Ú§ã§Ý§Ñ §±§à§Õ§Õ§Ö§â§Ø§Ü§Ñ plural forms §Ö§ã§ä§î §Ó §Ñ§Õ§Ñ§á§ä§Ö§â§Ñ§ç: Array Csv Gettext §²§Ñ§Ù§Ò§Ö§â§Ö§Þ §ß§Ñ §á§â§Ú§Þ§Ö§â§Ö: ./application/controllers/IndexController.php public function indexAction() { echo $this -> view ->translate( 'Hello' ) . '! ' ; $count = 5; echo sprintf( $this -> view ->translate( array ( '%s day' , '%s days' , $count )), $count ) . ' ' . $this -> view ->translate( 'left before the conference' ); }
  • 9. Plural Forms (§á§â§à§Õ§à§Ý§Ø§Ö§ß§Ú§Ö) §°§Ò§ß§à§Ó§Ú§Þ §æ§Ñ§Û§Ý §á§Ö§â§Ö§Ó§à§Õ§à§Ó §Õ§Ý§ñ §â§å§ã§ã§Ü§à§Ô§à §ñ§Ù§í§Ü§Ñ: ./application/languages/ru/application.php <?php return array ( 'Hello' => '§±§â§Ú§Ó§Ö§ä' , 'left before the conference' => '§à§ã§ä§Ñ§Ý§à§ã§î §Õ§à §ß§Ñ§é§Ñ§Ý§Ñ §Ü§à§ß§æ§Ö§â§Ö§ß§è§Ú§Ú' , '%s day' => array ( '%s §Õ§Ö§ß§î' , '%s §Õ§ß§ñ' , '%s §Õ§ß§Ö§Û' ) ); §²§Ö§Ù§å§Ý§î§ä§Ñ§ä: §±§â§Ú§Ó§Ö§ä! 5 §Õ§ß§Ö§Û §à§ã§ä§Ñ§Ý§à§ã§î §Õ§à §ß§Ñ§é§Ñ§Ý§Ñ §Ü§à§ß§æ§Ö§â§Ö§ß§è§Ú§Ú
  • 10. §±§à§é§Ö§Þ§å §ñ §à§ä§Õ§Ñ§ð §á§â§Ö§Õ§á§à§é§ä§Ö§ß§Ú§Ö gettext? §£ §Ü§à§Õ§Ö §à§ä§à§Ò§â§Ñ§Ø§Ñ§ð§ä§ã§ñ §à§â§Ú§Ô§Ú§ß§Ñ§Ý§í §ã§à§à§Ò§ë§Ö§ß§Ú§Û. §±§â§Ú§Þ§Ö§â §ã§à§à§Ò§ë§Ö§ß§Ú§ñ §Ó view §ê§Ñ§Ò§Ý§à§ß§Ö: <h2> <?php echo $this ->translate( 'Create new brand' ); ?>: </h2> §¯§Ö §ß§å§Ø§ß§à §Ú§ã§Ü§Ñ§ä§î §Ô§Õ§Ö §Ú §Ü§Ñ§Ü§Ú§Ö §ã§ä§â§à§Ü§Ú §Ò§í§Ý§Ú §Õ§à§Ò§Ñ§Ó§Ý§Ö§ß§í §Ú§Ý§Ú §å§Õ§Ñ§Ý§Ö§ß§í §Ó §Ú§ã§ç§à§Õ§ß§à§Þ §Ü§à§Õ§Ö ¡ª gettext §ã§Ñ§Þ §ß§Ñ§Û§Õ§Ö§ä §Ó§ã§Ö §Ú§Ù§Þ§Ö§ß§Ö§ß§Ú§ñ. §¦§ã§ä§î §Ô§à§ä§à§Ó§í§Ö §á§â§à§Ô§â§Ñ§Þ§Þ§í §Õ§Ý§ñ §â§Ñ§Ò§à§ä§í §ã §æ§Ñ§Û§Ý§Ñ§Þ§Ú §á§Ö§â§Ö§Ó§à§Õ§à§Ó (§à§ã§à§Ò§Ö§ß§ß§à §Ñ§Ü§ä§å§Ñ§Ý§î§ß§à §Õ§Ý§ñ §¯§¦§á§â§à§Ô§â§Ñ§Þ§Þ§Ú§ã§ä§à§Ó). §¥§à§ã§ä§Ñ§ä§à§é§ß§à §á§â§Ö§Õ§à§ã§ä§Ñ§Ó§Ú§ä§î §Ù§Ñ§Ü§Ñ§Ù§é§Ú§Ü§å §Ú§Ý§Ú §á§Ö§â§Ó§à§Õ§é§Ú§Ü§å .po §æ§Ñ§Û§Ý §Ú §á§â§à§Ô§â§Ñ§Þ§Þ§å §Õ§Ý§ñ §Ö§Ô§à §â§Ö§Õ§Ñ§Ü§ä§Ú§â§à§Ó§Ñ§ß§Ú§ñ (§ß§Ñ§á§â§Ú§Þ§Ö§â §Ü§â§à§ã§ã§á§Ý§Ñ§ä§æ§à§â§Þ§Ö§ß§ß§Ñ§ñ Poedit ).
  • 11. §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit. §¯§Ñ§ã§ä§â§à§Û§Ü§Ú §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ §³§à§Ù§Õ§Ñ§Ö§Þ §ß§à§Ó§í§Û §Ü§Ñ§ä§Ñ§Ý§à§Ô §¶§Ñ§Û§Ý->§³§à§Ù§Õ§Ñ§ä§î §Ü§Ñ§ä§Ñ§Ý§à§Ô . §µ§Ü§Ñ§Ù§í§Ó§Ñ§Ö§Þ §ß§Ö§à§Ò§ç§à§Õ§Ú§Þ§í§Ö §ß§Ñ§ã§ä§â§à§Û§Ü§Ú:
  • 12. §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit. §¯§Ñ§ã§ä§â§à§Û§Ü§Ñ §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ (§á§â§à§Õ§à§Ý§Ø§Ö§ß§Ú§Ö) §°§Ò§ñ§Ù§Ñ§ä§Ö§Ý§î§ß§à §å§Ü§Ñ§Ù§í§Ó§Ñ§Û§ä§Ö §æ§à§â§Þ§í §Þ§ß§à§Ø§Ö§ã§ä§Ó§Ö§ß§ß§à§Ô§à §é§Ú§ã§Ý§Ñ §Õ§Ý§ñ §Ü§Ñ§Ø§Õ§à§Ô§à §á§Ö§â§Ö§Ó§à§Õ§Ñ! §±§à§Ý§ß§í§Û §ã§á§Ú§ã§à§Ü §æ§à§â§Þ §Þ§à§Ø§ß§à §ß§Ñ§Û§ä§Ú §ß§Ñ §ã§ä§â§Ñ§ß§Ú§è§Ö http://translate.sourceforge.net/wiki/l10n/pluralforms §¯§Ñ§á§â§Ú§Þ§Ö§â §Õ§Ý§ñ §â§å§ã§ã§Ü§à§Ô§à: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 or n%100>=20) ? 1 : 2) §Õ§Ý§ñ §ß§Ö§Þ§Ö§è§Ü§à§Ô§à: nplurals=2; plural=(n != 1)
  • 13. §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã poedit. §±§å§ä§Ú §¯§Ñ §Ó§Ü§Ý§Ñ§Õ§Ü§Ö ? §±§å§ä§Ú ? §å§Ü§Ñ§Ù§í§Ó§Ñ§Ö§Þ §á§å§ä§î §Ü §Ü§Ñ§ä§Ñ§Ý§à§Ô§å §á§â§à§Ö§Ü§ä§Ñ §Ú§Ý§Ú §á§å§ä§Ú §Ü §Ü§Ñ§ä§Ñ§Ý§à§Ô§Ñ§Þ §Ü§à§ä§à§â§í§Ö §ß§å§Ø§ß§à §ã§Ü§Ñ§ß§Ú§â§à§Ó§Ñ§ä§î:
  • 14. §²§Ñ§Ò§à§ä§Ñ§Ö§Þ poedit. §¬§Ý§ð§é§Ö§Ó§í§Ö §ã§Ý§à§Ó§Ñ §´§Ñ§Ü§Ø§Ö §Õ§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §ß§Ñ§Ù§Ó§Ñ§ß§Ú§ñ §æ§å§ß§Ü§è§Ú§Û, §ã§ä§â§à§Ü§à§Ó§í§Ö §Ñ§â§Ô§å§Þ§Ö§ß§ä§í §Ü§à§ä§à§â§í§ç §Õ§à§Ý§Ø§ß§í §Õ§à§Ò§Ñ§Ó§Ý§ñ§ä§ã§ñ §Ó §ñ§Ù§í§Ü§à§Ó§í§Û §æ§Ñ§Û§Ý (§Ó§Ü§Ý§Ñ§Õ§Ü§Ñ ? §¬§Ý§ð§é§Ö§Ó§í§Ö §ã§Ý§à§Ó§Ñ ?):
  • 15. §¥§Ý§ñ §é§Ö§Ô§à §ñ §Õ§à§Ò§Ñ§Ó§Ú§Ý plural:1,2? §Á §ß§Ö §Ù§ß§Ñ§ð §Ü§Ñ§Ü §Ù§Ñ§ã§ä§Ñ§Ó§Ú§ä§î §á§Ñ§â§ã§Ö§â xgettext §Õ§à§ã§ä§Ñ§Ó§Ñ§ä§î §ã§ä§â§à§Ü§Ú §Ú§Ù §ä§Ñ§Ü§à§Û §Ü§à§ß§ã§ä§â§å§Ü§è§Ú§Ú: $this -> view ->translate( array ( '%s day' , '%s days' , $count ) §¯§à §à§ß §å§ã§á§Ö§ê§ß§à §Õ§à§ã§ä§Ñ§Ö§ä §Ú§ç §Ú§Ù §Ü§à§ß§ã§ä§â§å§Ü§è§Ú§Ú §Ó§Ú§Õ§Ñ: $this -> view ->translate()->getTranslator()->plural( '%s day' , '%s days' , $count )
  • 16. §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã Poedit. §°§Ò§ß§à§Ó§Ý§ñ§Ö§Þ §Ü§Ñ§ä§Ñ§Ý§à§Ô §Ú§Ù §Ú§ã§ç§à§Õ§ß§í§ç §æ§Ñ§Û§Ý§à§Ó §³§à§ç§â§Ñ§ß§ñ§Ö§Þ §Ü§Ñ§ä§Ñ§Ý§à§Ô ./application/languages/ru/application.po §ª §à§Ò§à§Ó§Ý§ñ§Ö§Þ §Ö§Ô§à §¬§Ñ§ä§Ñ§Ý§à§Ô->§°§Ò§ß§à§Ó§Ú§ä§î §Ú§Ù §Ú§ã§ç§à§Õ§ß§à§Ô§à §Ü§à§Õ§Ñ §±§à§Ý§å§é§Ñ§Ö§Þ §ã§Ý§Ö§Õ§å§ð§ë§å§ð §Ü§Ñ§â§ä§Ú§ß§å:
  • 17. §²§Ñ§Ò§à§ä§Ñ§Ö§Þ §ã Poedit. §¥§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §á§Ö§â§Ö§Ó§à§Õ§í §Ú §ã§à§ç§â§Ñ§ß§ñ§Ö§Þ §Ü§Ñ§ä§Ñ§Ý§à§Ô §³§à§ç§â§Ñ§ß§ñ§Ö§Þ §â§Ö§Ù§å§Ý§î§ä§Ñ§ä. §£ §á§Ñ§â§Ñ§Þ§Ö§ä§â§Ñ§ç §Õ§à§Ý§Ø§ß§Ñ §Ò§í§ä§î §à§ä§Þ§Ö§é§Ö§ß§Ñ §à§á§è§Ú§ñ ¡±§±§â§Ú §ã§à§ç§â§Ñ§ß§Ö§ß§Ú§Ú §Ñ§Ó§ä§à§Þ§Ñ§ä§Ú§é§Ö§ã§Ü§Ú §Ü§à§Þ§á§Ú§Ý§Ú§â§à§Ó§Ñ§ä§î §æ§Ñ§Û§Ý .mo ¡±. §£ application.ini §Þ§Ö§ß§ñ§Ö§Þ §Ñ§Õ§Ñ§á§ä§Ö§â §ß§Ñ: resources.translate.adapter = &quot;gettext&quot; §©§Ñ§á§å§ã§Ü§Ñ§Ö§Þ: §±§â§Ú§Ó§Ö§ä! 5 §Õ§ß§Ö§Û §à§ã§ä§Ñ§Ý§à§ã§î §Õ§à §ß§Ñ§é§Ñ§Ý§Ñ §Ü§à§ß§æ§Ö§â§Ö§ß§è§Ú§Ú
  • 18. §¯§î§ð§Ñ§ß§ã§í §Ú §ç§Ñ§Ü§Ú §Õ§Ý§ñ §â§Ñ§Ò§à§ä§í §ã gettext §­§Ö§Û§Ò§Ý§í §æ§à§â§Þ§í §ß§å§Ø§ß§à §à§Ò§à§â§Ñ§é§Ú§Ó§Ñ§ä§î §Ó _(). §±§â§Ú§Þ§Ö§â: $username = $form ->createElement( 'text' , 'username' ); $username ->setLabel( _( '§ª§Þ§ñ §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§ñ' ) ); §´§à§Ý§î§Ü§à §é§ä§à §á§à§Õ§å§Þ§Ñ§Ý §à §ä§à§Þ, §é§ä§à setLabel §ä§à§Ø§Ö §Þ§à§Ø§ß§à §Õ§à§Ò§Ñ§Ó§Ú§ä§î §Ó §Ü§Ý§ð§é§Ö§Ó§í§Ö §ã§Ý§à§Ó§Ñ :). §´§Ñ §Ø§Ö §ã§Ú§ä§å§Ñ§è§Ú§ñ §ã §ß§Ñ§Ù§Ó§Ñ§ß§Ú§ñ§Þ§Ú §á§å§ß§Ü§ä§à§Ó §Þ§Ö§ß§ð §Õ§Ý§ñ Zend_Navigation: array ( 'controller' => 'users' , 'action' => 'list' , 'resource' => 'mvc:users' , 'privilege' => 'list' , 'label' => _( 'Users' ) , 'route' => 'default' , )
  • 19. §±§Ö§â§Ö§Ó§à§Õ §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §Õ§Ý§ñ §Ñ§Õ§Ñ§á§ä§Ö§â§à§Ó != array §²§Ñ§ß§î§ê§Ö §Þ§í §Õ§Ö§Ý§Ñ§Ý§Ú §à§ä§Õ§Ö§Ý§î§ß§í§Û §æ§Ñ§Û§Ý§Ú§Ü, §Ü§à§ä§à§â§í§Û §ã§à§Õ§Ö§â§Ø§Ñ§Ý §Ó§ã§Ö §ã§à§à§Ò§ë§Ö§ß§Ú§ñ §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §à§Ò§Ö§â§ß§å§ä§í§Ö §Ó _(): _( &quot;A record matching amp;quot;%value%amp;quot; was found&quot; ); _( &quot;Password and confirmed password do not match.&quot; ); xgettext §ï§ä§à§ä §æ§Ñ§Û§Ý §á§Ñ§â§ã§Ú§Ý, §Ñ §Þ§í §á§Ö§â§Ö§Ó§à§Õ§Ú§Ý§Ú §Ú §Ü§à§Þ§á§Ú§Ý§Ú§â§à§Ó§Ñ§Ý§Ú .mo §æ§Ñ§Û§Ý, §Ü§à§ä§à§â§í§Û §å§Ø§Ö §á§à§Õ§Ü§Ý§ð§é§Ñ§Ý§Ú §Ü§à §Ó§ã§Ö§Þ §á§â§à§Ö§Ü§ä§Ñ§Þ. §´§Ö§á§Ö§â§î §Ó ZF §á§à§ñ§Ó§Ú§Ý§Ñ§ã§î §á§Ñ§á§à§é§Ü§Ñ resources , §Ó §Ü§à§ä§à§â§à§Û §Ý§Ö§Ø§Ñ§ä §á§Ö§â§Ö§Ó§à§Õ§í §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó. §¯§à §Ü§Ñ§Ü §Ú§ç§á§à§Õ§Ü§Ý§ð§é§Ú§ä§î §Ö§ã§Ý§Ú §Õ§Ý§ñ §à§ã§ß§à§Ó§ß§à§Ô§à §ã§Ñ§Û§ä§Ñ §Ú§ã§á§à§Ý§î§Ù§å§Ö§ä§ã§ñ §Ñ§Õ§Ñ§á§ä§Ö§â §à§ä§Ý§Ú§é§ß§í§Û §à§ä array §ñ §á§à§Ü§Ñ §ß§Ö §â§Ñ§Ù§à§Ò§â§Ñ §Ý§ã§ñ . §¥§å§Þ§Ñ§ð, §é§ä§à §Ó§ã§Ü§à§â§Ö §â§Ñ§Ù§Ò§Ö§â§å§ã§î §Ú §â§Ö§ê§Ö§ß§Ú§Ö §Ò§å§Õ§Ö§ä §à§á§å§Ò§Ý§Ú§Ü§à§Ó§Ñ§ß§à §ß§Ñ §ã§Ñ§Û§ä§Ö §Ú§Ý§Ú §æ§à§â§å§Þ§Ö http://zendframework.ru
  • 20. §±§Ö§â§Ö§Ó§à§Õ §ã§à§à§Ò§ë§Ö§ß§Ú§Û §Ó§Ñ§Ý§Ú§Õ§Ñ§ä§à§â§à§Ó §Õ§Ý§ñ §Ñ§Õ§Ñ§á§ä§Ö§â§Ñ array §¥§Ý§ñ array §Ó§ã§Ö §ß§Ñ§Þ§ß§à§Ô§à §á§â§à§ë§Ö. §¥§à§Ò§Ñ§Ó§Ý§ñ§Ö§Þ §Ó Bootstrap.php §ä§Ñ§Ü§à§Û §Þ§Ö§ä§à§Õ: /** * Init translator to Zend_Validate * @return Zend_Translate */ public function _initZendValidateTranslator() { $this ->bootstrap( 'translate' ); $translate = $this ->getResource( 'translate' ); $translate ->addTranslation(APPLICATION_PATH . '/../resources/languages' ); return $translate ; }
  • 21. §£§Ñ§â§Ú§Ñ§ß§ä§í §á§Ö§â§Ö§Õ§Ñ§é§Ú §ñ§Ù§í§Ü§Ñ §Ó URL §Á§Ù§í§Ü §ß§Ñ §á§à§Õ§Õ§à§Þ§Ö§ß§Ö ( Zend_Controller_Router_Route_Hostname ) : en.wikipedia.org ru.wikipedia.org §Á§Ù§í§Ü §Ó §á§à§Õ§Õ§Ú§â§Ö§Ü§ä§à§â§Ú§Ú: 1§Û §Ó§Ñ§â§Ú§Ñ§ß§ä ( CyEngine_Controller_Router_Route_Multilingual ): mota.ru ¨C §â§å§ã§ã§Ü§Ú§Û mota.ru/en/ ¨C §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§Ú§Û 2§Û §Ó§Ñ§â§Ú§Ñ§ß§ä ( §á§Ö§â§Ö§à§á§â§Ö§Õ§Ö§Ý§ñ§Ö§Þ Zend_Controller_Router_Route ): preorder.it ¨C ¡±auto¡± §Ú§Ý§Ú §á§à §Ò§Ñ§Ù§Ö GeoIP preorder.it/ru/ ¨C §â§å§ã§ã§Ü§Ú§Û preorder.it/en/ ¨C §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§Ú§Û
  • 22. §Á§Ù§í§Ü §ß§Ñ §á§à§Õ§Õ§à§Þ§Ö§ß§Ö +/- + §µ§ã§Ü§à§â§Ö§ß§ß§Ñ§ñ §Ú§ß§Õ§Ö§Ü§ã§Ñ§è§Ú§ñ. §¥§Ý§ñ §Õ§à§Þ§Ö§ß§à§Ó §á§Ö§â§Ó§à§Ô§à §å§â§à§Ó§ß§ñ, §Ü§à§ä§à§â§í§Ö §ß§Ö §Ú§Þ§Ö§ð§ä §Ô§Ö§à§Ô §â §Ñ§æ§Ú§é§Ö§ã§Ü§à§Û §á§â§Ú§Ó§ñ§Ù§Ü§Ú §Þ§à§Ø§ß§à §ß§Ñ§ã§ä§â§à§Ú§ä§î §â§Ñ§Ù§ß§í§Ö §Ô§Ö§à§Ô§â§Ñ§æ§Ú§é§Ö§ã§Ü§Ú§Ö §è§Ö§Ý§Ú §Õ§Ý§ñ §Ü§Ñ§Ø§Õ§à§Û §ñ§Ù§í§Ü§à§Ó§à§Û §Ó§Ö§â§ã§Ú§Ú §ã§Ñ§Û§ä§Ñ (§Ó Google Webmaster Tools). §£§Ö§ã §ã §à§ã§ß§à§Ó§ß§à§Ô§à §Õ§à§Þ§Ö§ß§Ñ §á§Ö§â§Ö§Õ§Ñ§Ö§ä§ã§ñ §ß§Ñ §á§à§Õ§Õ§à§Þ§Ö§ß§í. §³§Ñ§Û§ä§í §Þ§à§Ø§ß§à §â§Ñ§Ù§ß§Ö§ã§ä§Ú §ß§Ñ §â§Ñ§Ù§ß§í§Ö §ã§Ö§â§Ó§Ö§â§Ñ §Ú §Õ§Ö§Ý§Ñ§ä§î §ß§Ö§Ù§Ñ§Ó§Ú§ã§Ú§Þ§í§Ö §Ú§Ù§Þ§Ö§ß§Ö§ß§Ú§ñ §Ó §Ü§à§Õ§Ö. - §¢§ð§Õ§Ø§Ö§ä §ß§Ñ §á§â§à§Õ§Ó§Ú§Ø§Ö§ß§Ú§Ö §Ú §ï§æ§æ§Ö§Ü§ä §à§ä §ß§Ö§Ô§à §Ò§å§Õ§Ö§ä §Õ§â§à§Ò§Ú§ä§î§ã§ñ §ß§Ñ §Ó§ã§Ö §ã§Ñ§Û§ä§í.
  • 23. §Á§Ù§í§Ü §Ó §á§à§Õ§Õ§Ú§â§Ö§Ü§ä§à§â§Ú§Ú +/- + §¥§à§ã§ä§Ñ§ä§à§é§ß§à §á§â§à§ã§ä§à §â§Ö§Ñ§Ý§Ú§Ù§à§Ó§Ñ§ä§î §Ó ZF. §·§à§â§à§ê§à §á§à§Õ§ç§à§Õ§Ú§ä §Õ§Ý§ñ §ã§Ñ§Û§ä§à§Ó-§å§ã§Ý§å§Ô. §ª§Õ§Ö§ä §á§â§à§Õ§Ó§Ú§Ø§Ö§ß§Ú§ñ §à§Õ§ß§à§Ô§à §Õ§à§Þ§Ö§ß§Ñ, §ä.§Ö. §ä§à§ä §Ø§Ö §Ò§ð§Õ§Ø§Ö§ä §é§ä§à §Ú §Ó §á§Ö§â§Ó§à§Þ §Ó§Ñ§â§Ú§Ñ§ß§ä§Ö §Õ§Ñ§ã§ä §Ò§à§Ý§î§ê§Ú§Û §ï§æ§æ§Ö§Ü§ä. - §¢§à§Ý§Ö§Ö §Þ§Ö§Õ§Ý§Ö§ß§ß§Ñ§ñ §Ú§ß§Õ§Ö§Ü§ã§Ñ§è§Ú§ñ. §¯§Ö§Ý§î§Ù§ñ §ã§Õ§Ö§Ý§Ñ§ä§î §â§Ñ§Ù§ß§í§Ö §Ô§Ö§à§Ô §â §Ñ§æ§Ú§é§Ö§ã§Ü§Ú§Ö §è§Ö§Ý§Ú §Õ§Ý§ñ §â§Ñ§Ù§ß§í§ç §ñ§Ù§í§Ü§à§Ó§í§ç §Ó§Ö§â§ã§Ú§Û §ã§Ñ§Û§ä§Ñ. §³ §ä§Ö§ç§ß§Ú§é§Ö§ã§Ü§à§Û §ã§ä§à§â§à§ß§í §Ò§å§Õ§Ö§ä §á§â§à§Ò§Ý§Ö§Þ§Ñ§ä§Ú§é§ß§à §â§Ñ§Ù§ß§Ö§ã§ä§Ú §â§Ñ§Ù§ß§í§Ö §ñ§Ù§í§Ü§à§Ó§í§Ö §Ó§Ö§â§ã§Ú§Ú §ã§Ñ§Û§ä§Ñ §ß§Ñ §â§Ñ§Ù§ß§í§Ö §ã§Ö§â§Ó§Ö§â§Ñ.
  • 24. §¯§Ö§ã§Ü§à§Ý§î§Ü§à §ã§ä§â§à§é§Ö§Ü §Ü§à§Õ§Ñ, §Ü§à§ä§à§â§í§Ö §Õ§Ö§Ý§Ñ§ð§ä §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§Ö §Ò§í§ã§ä§â§Ö§Ö :) §¦§ã§Ý§Ú §Ö§ã§ä§î §Ó§à§Ù§Þ§à§Ø§ß§à§ã§ä§î §é§ä§à-§ä§à §Ù§Ñ§Ü§Ö§ê§Ú§â§à§Ó§Ñ§ä§î, §Ù§ß§Ñ§é§Ú§ä §ß§å§Ø§ß§à §Ö§× §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ä§î: $cache = Zend_Cache:: factory ( 'Core' , 'File' , array ( 'caching' => true , 'automatic_serialization' => true , 'lifetime' => 3600, ), array ( 'cache_dir' => realpath(APPLICATION_PATH . '/../tmp' ), ) ); Zend_Translate:: setCache ( $cache );
  • 25. The end ? §¢§Ý§Ñ§Ô§à§Õ§Ñ§â§ð §Ù§Ñ §Ó§ß§Ú§Þ§Ñ§ß§Ú§Ö! §©§Ñ§Õ§Ñ§Ó§Ñ§Û§ä§Ö §Ó§Ñ§ê§Ú §Ó§à§á§â§à§ã§í ;) §³§ä§Ö§á§Ñ§ß §´§Ñ§ß§Ñ§ã§Ú§Û§é§å§Ü [email_address]