2017-10-06 4 views
0

새로운 다국어 웹 사이트를 만들려고합니다. 나는 poEDitgetText() 기능을 사용합니다. 나는이 코드로 내가 무엇을 놓쳤는 지 모른다 :다중 언어 웹 사이트 poEDit 및 getText()

<?php 
    if (!function_exists("gettext")) 
    { 
     echo "gettext is not installed\n"; 
    } else { 
     echo "gettext is supported\n"; 
    } 

    $language = 'ar_JO'; 
    putenv("LANG=$language"); 
    setlocale(LC_ALL, $language); 

    $domain = 'ar_JO'; 
    bindtextdomain($domain, "./locale"); 
    bind_textdomain_codeset($domain, 'UTF-8'); 
    textdomain($domain); 

    echo _("HELLO_WORLD"); 
    echo _("hi this to be translated "); 

답변

0

매우 수입되었다. 나는이 가지고

<?php 

$locale = 'de_DE'; 
//$locale = 'fr_CH'; 
$domain = 'messages'; 
$codeset = 'UTF-8'; 
$directory = __DIR__ . '/locale'; 

// Activate the locale settings 
putenv('LC_ALL=' . $locale); 
setlocale(LC_ALL, $locale); 

// Debugging output 
$file = sprintf('%s/%s/LC_MESSAGES/%s_%s.mo', $directory, $locale, $domain, $locale); 
echo $file . "\n"; 

// Generate new text domain 
$textDomain = sprintf('%s_%s', $domain, $locale); 

// Set base directory for all locales 
bindtextdomain($textDomain, $directory); 

// Set domain codeset (optional) 
bind_textdomain_codeset($textDomain, $codeset); 

// File: ./locale/de_DE/LC_MESSAGES/messages_de_DE.mo 
textdomain($textDomain); 

// test translations 
echo _('Yes'); 
+0

"C를 : \ WAMP \ www가 loginSystemOOP \/로케일/ar_JO/LC_MESSAGES/messages_ar_JO.mo"

locale/de_DE/LC_MESSAGES/messages_de_DE.mo locale/de_DE/LC_MESSAGES/messages_de_DE.po 

그런 다음이 예제 코드를 시도 :이 같은 디렉토리 구조를 만들기 이고 내 파일 구조는 'C : \ wamp \ www \ loginSystemOOP/locale/ar_JO/LC_MESSAGES /'입니다. –