2011-05-06 4 views
1

PHP 응용 프로그램을 작성하고 gettext 모듈을 사용하여 다른 언어로 번역하고 있습니다.리눅스에서 로케일 작업을 할 수 없습니다.

코드는

{ 
     $locale_folder = dirname(dirname(dirname(__FILE__))).'/locale/'; 
     $locale = 'he_IL'; 


     $domain = 'myapp'; 
     $autoreload = true; 

     // activate the locale setting 
     setlocale(LC_ALL, $locale); 
     setlocale(LC_TIME, $locale); 

     putenv("LANG=$locale"); 
     putenv("LANGUAGE=$locale"); 
     putenv("LC_ALL=$locale"); 
     putenv("LC_MESSAGES=$locale"); 

     if ($autoreload) { 
      // path to the .MO file that we should monitor 
      $filename = "$locale_folder/$locale/LC_MESSAGES/$domain.mo"; 
      $mtime = filemtime($filename); // check its modification time 
      // our new unique .MO file 
      $filename_new = "$locale_folder/$locale/LC_MESSAGES/{$domain}_{$mtime}.mo"; 

      if (!file_exists($filename_new)) { // check if we have created it before 
        // if not, create it now, by copying the original 
        copy($filename,$filename_new); 
      } 

      // compute the new domain name 
      $domain_new = "{$domain}_{$mtime}"; 
     } else { 
       $domain_new = $domain; 
     } 

     // bind it 
     bindtextdomain($domain_new,$locale_folder); 
     // then activate it 
     textdomain($domain_new); 

     bind_textdomain_codeset($domain_new, "UTF-8"); 
} 

내가 실행했다 (Windows가 WAMP를 실행),하지만 난이 서버에서 작동 할 수 없습니다 (유닉스 + 아파치) 내 로컬 컴퓨터에서 예상대로 작동 "sudo는 로케일 -get he_IL "및"sudo locale-get he_IL.UTF-8 "을 사용하여 언어 구성 요소를 설치하십시오.

번역은 로컬 (윈도우) 컴퓨터에서 작업하지만, 서버의 원래 문자열 (번역되지 않음)를 표시 ...

내가 무엇을 구성해야합니까입니까?

+2

Perhpas 설치되어 있는지 확인하는 리눅스 시스템에서 로케일 -a를 실행 해보십시오 :이 무엇 분포? – sehe

답변

2

는 로케일이 제대로 하찮은 일에 속 태우고 수준의 위 관련

+0

이것은 아마도 답이 아닌 질문에 대한 의견으로 더 적절할 것입니다. 러닝 로케일 -a는 질문에 대답하지 않을 것이며, 질문에 대답하는 데 도움이되는 정보 만 제공합니다. –

관련 문제