2016-12-18 10 views
1

다국어 사이트에 "Polylang"플러그인을 사용하고 있습니다. 따라서 문자열 번역에는 적합하지 않은 몇 가지 사항이 있습니다. 내가 바꿀 수있는 주제가 적당해진다. 그러나, 다른 사람들을 위해, 나는 할 수 없었다.WordPress 개인 테마에서 하드 코딩 된 문자열을 적절한 번역 가능한 얼룩으로 변환하는 방법은 무엇입니까?

다음은 아래 코드입니다.

템플릿 contacts.php

원본 코드

if ($message_btn) : ?> 
     <div id="contacts-modal" class="reveal-modal"> 
      <h1 class="entry-header"><?php _e('Send message', 'fluxus'); ?></h1> 
      <div class="modal-contents"></div> 
      <a class="close-reveal-modal">&#215;</a> 
     </div><?php 
    endif; 

이 부분에 대한 작동

if ($message_btn) : ?> 
    <div id="contacts-modal" class="reveal-modal"> 
     <h1 class="entry-header"><?php pll_e('Send message'); ?></h1> 
     <div class="modal-contents"></div> 
     <a class="close-reveal-modal">&#215;</a> 
    </div><?php 
endif; 

나는 변경 코드를했습니다. 그러나 메시지 및보기 맵 단추를 보내고 바닥 글의 "탐색에 화살표 % s 키 사용"텍스트도 있습니다. 나는 변화를 성공하지 못하고이 부분을 해결합니다. 코드는 다음과 같습니다.

if ($has_map) { 
    $view_btn = '<a id="view-map" href="#" class="button icon-location">' . __('View map', 'fluxus') . '</a>'; 
} else { 
    $view_btn = ''; 
} 

/** 
* Show Send Message button only if there is a [contact-form-7] short tag 
* in the content. 
*/ 
if (preg_match('/\[contact\-form\-7.+?\]/is', $post->post_content)) { 
    $message_btn = '<a id="send-message" href="#" class="button icon-paper-plane">' . __('Send message', 'fluxus') . '</a>'; 
} else { 
    $message_btn = ''; 
} 

?> 

위의 부품을 어떻게 변경할 수 있습니까? pll__('Send message') 물론 '지도'와 '메시지를 보내'의

__('View map', 'fluxus')-pll__('View map')

__('Send message', 'fluxus')을 변경하는

답변

2

시도는 이전

pll_e( 또는 _e( 문자열 및 __( 에코 등록해야 또는 pll_( 문자열을 반환합니다.