0
다국어 지원 사이트 (Smarty 템플릿 사용)가 있습니다. 모든 언어는 다른 lang.ini 파일에 있습니다. 예 다음의 index.php에이어서PHP 파일의 변수 값 - Smarty 다국어
WELCOME = "Üdvözöllek"
(헝가리어) :
WELCOME = "Welcome"
LANG/훈 /하여 Lang.ini (영어) LANG/영어 /하여 Lang.ini 마지막으로 한편, index.tpl의
...
$error=array();
if($condition!=$condition2)
{
$error1 = "This is an error msg";
array_push($error, $error1);
}
...
$this->tpl->assign('error', $error);
$lang_file=parse_ini_file("lang/". $_SESSION["lang_folder"] ."/lang.ini",true);
$this->tpl->assignByref("lang",$lang_file);
$this->tpl->display('index.tpl');
:
...
{$lang.WELCOME}
<br />
{if isset($error) && $error ne "" }
{foreach $error as $error_list}
{$error_list}
{/foreach}
{/if}
...
환영 메시지가 다른 언어 (세션에 저장된 경로)로 나타날 수 있습니다. 하지만 $ 오류는 하나의 언어로만 나타나며 그 값만 인쇄합니다. 선택한 언어에 따라 어떻게 인쇄 할 수 있습니까? $ 오류에 어디에서 가치를 추가해야합니까?
내게 ERROR_ONE을 인쇄합니다 – Gery
죄송합니다. 실수를 저질렀다고 생각합니다. – Gery