프로그램

PHP : __("TEXT") 의 용법

(주)CKBcorp., 2012. 4. 17. 16:46
반응형

마치 MFC 에서의 _("TEXT") 와 비슷하다. 

다국어 대응용 코드라는 군. 

잘 설명된 게 있어서, 그대로 퍼옴.


출처 : http://stackoverflow.com/questions/2427204/php-what-does-some-text-do


In Kohana (version 3) the function is defined in system/base.php and is a convenience function to aid (as the other answers have mentioned) internationalization. You provide a string (with, optionally, some placeholders to substitute values into the finished text) which is then interpreted and, if required, a translation is is returned.

Contrary to assumptions in other answers, this does not use gettext.

A very basic example would be (this particular string is already translated into English, Spanish and French in Kohana):

// 1. In your bootstrap.php somewhere below the Kohana::init line
I18n
::lang('fr');

// 2. In a view
echo __
("Hello, world!"); // Bonjour, monde!





PS: PHP Section 을 따로 빼야 되나?? @_@ 

 


반응형