[G5] 다국어 홈페이지 사용하기
출처 : [G5] 다국어 홈페이지 사용하기 > 기술자료 | 해피정닷컴 (happyjung.com)
[G5] 다국어 홈페이지 사용하기 > 기술자료 | 해피정닷컴
그누보드 G5 에서 다국어 홈페이지를 이용하는 방법입니다. 실시간 번역 방식이 아닌 별도 게시판과 컨텐츠 페이지를 이용하는 방법입니다. HI…
www.happyjung.com
그누보드 G5 에서 다국어 홈페이지를 이용하는 방법입니다.
실시간 번역 방식이 아닌 별도 게시판과 컨텐츠 페이지를 이용하는 방법입니다.
HISTORY
2016-11-03 최초작성
2021-06-11 작업순서 변경
1. 게시판 생성
게시판 이름을 생성할때 게시판 이름 뒤에 언어코드를 추가해서 생성했습니다.
예를 들면 자유게시판 을 아래와 같이 생성했습니다.
한글 : free
영어 : free_en
중문 : free_cn
일어 : free_jp
2. 그누보드5 / index.php 을 index_en.php 로 복사후 내용 수정
<?php
include_once('./_common.php');
define('_INDEX_', true);
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (G5_IS_MOBILE) {
include_once(G5_THEME_MOBILE_PATH.'/index_en.php');
return;
}
require_once(G5_THEME_PATH.'/index_en.php');
return;
3. 그누보드5 / bbs / content.php 를 content_en.php 복사후 내용 수정
include_once(G5_MOBILE_PATH.'/content.php'); 를
include_once(G5_MOBILE_PATH.'/content_en.php'); 로 변경
include_once('./_head.php'); 를
include_once(G5_THEME_PATH.'/head_en.php'); 로 변경
include_once(G5_THEME_PATH.'/tail.php'); 를
include_once(G5_THEME_PATH.'/tail_en.php'); 로 변경
include_once('./_tail.php'); 를
include_once(G5_THEME_PATH.'/tail_en.php'); 로 변경
4. 그누보드5 / theme / 테마명 / index.php 를 index_en.php 로 복사해서 내용 수정
<?php
include_once('./_common.php');
define('_INDEX_', true);
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if (G5_IS_MOBILE) {
include_once(G5_MOBILE_PATH.'/index_en.php');
return;
}
include_once(G5_THEME_PATH.'/head_en.php');
?>
본문
<?php
include_once(G5_THEME_PATH.'/tail_en.php');
5. 그누보드5 / theme / 테마명 / head.php 를 head_en.php 로 복사후 내용 수정
include_once(G5_THEME_MOBILE_PATH.'/head.php'); 를
include_once(G5_THEME_MOBILE_PATH.'/head_en.php'); 로 변경
6. 그누보드5 / theme / 테마명 / tail.php 를 tail_en.php 로 복사후 내용 수정
include_once(G5_THEME_MOBILE_PATH.'/tail.php'); 를
include_once(G5_THEME_MOBILE_PATH.'/tail_en.php'); 로 변경
content.php 를 content_en.php 로 변경
7. 그누보드5 / mobile / index_en.php 추가
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
require_once(G5_THEME_MOBILE_PATH.'/index_en.php');
return;
8. 그누보드5 / mobile / head_en.php 추가
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
require_once(G5_THEME_MOBILE_PATH."/head_en.php");
return;
9. 그누보드5 / mobile / tail_en.php 추가
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
require_once(G5_THEME_MOBILE_PATH."/tail_en.php");
return;
10. 그누보드5 / mobile / content.php 를 content_en.php 복사후 내용 수정
include_once('./_head.php'); 를
include_once(G5_THEME_PATH.'/head_en.php'); 로 수정
include_once('./_tail.php'); 를
include_once(G5_THEME_PATH.'/tail_en.php'); 로 수정
11. 그누보드5 / theme / 테마명 / mobile / head.php 를 head_en.php 로 복사후 내용 수정
모바일 메뉴는 g5의 환경설정에서 만든 메뉴를 사용할 수 없으므로 개별 작업이 필요합니다.
한글 모바일 메뉴에서 소스를 추출해서 메뉴부분을 head_en.php 에 적용합니다.
12. 그누보드5 / theme / 테마명 / mobile / tail.php 를 tail_en.php 로 복사후 내용 수정
13. 그누보드5 / theme / 테마명 / mobile / head_en.php 에 언어선택 메뉴 추가하기
<!-- } 상단 끝 -->
<hr>
<!-- 콘텐츠 시작 { -->
를 아래와 같이 변경
<!-- } 상단 끝 -->
<style>
#tnb {border-bottom:1px solid #ddd;background:#fff}
#tnb h3 {position:absolute;font-size:0;line-height:0;overflow:hidden}
#tnb ul {margin:0 auto;zoom:1}
#tnb ul:after {display:block;visibility:hidden;clear:both;content:""}
#tnb li {float:right;border-left:1px solid #ddd;margin-bottom:-1px;font-size:0.92em;width:25%; text-align:center}
#tnb a {display:inline-block;padding:0 10px;color:#646464;line-height:35px}
#tnb a:focus, #tnb a:hover {color:#253dbe;background:#fafafa}
#tnb .tnb_admin a{color:#ff0000;}
#tnb .tnb_left{float:left}
#tnb .tnb_left a{padding:0 14px}
#tnb .tnb_cart{border-right:1px solid #ddd;}
#tnb .tnb_community{border-right:1px solid #ddd}
#tnb .tnb_community i{font-size:15px}
#tnb .tnb_community{background:#e7e7e7;font-weight:bold;}
#tnb .tnb_community:focus, #tnb .tnb_community:hover {color:#333;border-bottom:0}
#tnb .tnb_community a{color:#253dbe;border-bottom:1px solid #e7e7e7}
</style>
<div id="tnb">
<ul>
<li class="tnb_left "><a href="<?php echo G5_URL; ?>/"><i class="fa fa-home" aria-hidden="true"></i> KOR</a></li>
<li class="tnb_left tnb_community"><a href="<?php echo G5_URL; ?>/index_en.php"><i class="fa fa-home" aria-hidden="true"></i> ENG</a></li>
</ul>
</div>
<!-- 콘텐츠 시작 { -->
14-1. 그누보드5 / bbs / wirte.php
$title_msg = '글쓰기';
를 아래와 같이 변경
if (preg_match('/_en/i', $bo_table)) $title_msg = 'Writing';
elseif (preg_match('/_jp/i', $bo_table)) $title_msg = '書き込み';
elseif (preg_match('/_cn/i', $bo_table)) $title_msg = '写作';
else $title_msg = '글쓰기';
14-2. 그누보드5 / bbs / wirte.php
$title_msg = '글수정';
를 아래와 같이 변경
if (preg_match('/_en/i', $bo_table)) $title_msg = 'Edit article';
elseif (preg_match('/_jp/i', $bo_table)) $title_msg = '文の変更';
elseif (preg_match('/_cn/i', $bo_table)) $title_msg = '编辑文章';
else $title_msg = '글수정';
14-3. 그누보드5 / bbs / wirte.php
$title_msg = '글답변';
를 아래와 같이 변경
if (preg_match('/_en/i', $bo_table)) $title_msg = 'Reply';
elseif (preg_match('/_jp/i', $bo_table)) $title_msg = '文の回答';
elseif (preg_match('/_cn/i', $bo_table)) $title_msg = '第二十答案';
else $title_msg = '글답변';
14-4. 그누보드5 / bbs / wirte.php
alert('비밀번호가 틀립니다.');
를 아래와 같이 변경
if (preg_match('/_en/i', $bo_table)) alert('The password is incorrect.');
elseif (preg_match('/_jp/i', $bo_table)) alert('パスワードが違います。');
elseif (preg_match('/_cn/i', $bo_table)) alert('密码不正确。');
else alert('비밀번호가 틀립니다.');
14-5. 그누보드5 / bbs / wirte.php
$captcha_html = captcha_html();
를 아래와 같이 변경합니다.
if (preg_match('/_en/i', $bo_table)) $captcha_html = captcha_html_en();
elseif (preg_match('/_jp/i', $bo_table)) $captcha_html = captcha_html_jp();
elseif (preg_match('/_cn/i', $bo_table)) $captcha_html = captcha_html_cn();
else $captcha_html = captcha_html();
15. 그누보드5 / plugin / kcaptcha / kcaptcha.lib.php
사용하는 캡차가 kcapthca 인 경우에는 해당됩니다.
다른 캡챠를 사용한다면 해당 파일을 수정해야 합니다.
// 캡챠 HTML 코드 출력
function captcha_html($class="captcha")
{
if(is_mobile())
$class .= ' m_captcha';
$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
//$html .= "\n".'<script>var g5_captcha_path = "'.G5_CAPTCHA_PATH.'";</script>';
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/kcaptcha.js"></script>';
$html .= "\n".'<fieldset id="captcha" class="'.$class.'">';
$html .= "\n".'<legend><label for="captcha_key">자동등록방지</label></legend>';
if (is_mobile()) $html .= '<audio id="captcha_audio" controls></audio>';
//$html .= "\n".'<img src="#" alt="" id="captcha_img">';
$html .= "\n".'<img src="'.G5_CAPTCHA_URL.'/img/dot.gif" alt="" id="captcha_img">';
$html .= '<input type="text" name="captcha_key" id="captcha_key" required class="captcha_box required" size="6" maxlength="6">';
if (!is_mobile()) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>숫자음성듣기</button>';
$html .= "\n".'<button type="button" id="captcha_reload"><span></span>새로고침</button>';
$html .= "\n".'<span id="captcha_info">자동등록방지 숫자를 순서대로 입력하세요.</span>';
$html .= "\n".'</fieldset>';
return $html;
}
아래에 언어별 함수를 추가합니다.
// 캡챠 HTML 코드 출력 # 영어
function captcha_html_en($class="captcha")
{
if(is_mobile())
$class .= ' m_captcha';
$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
//$html .= "\n".'<script>var g5_captcha_path = "'.G5_CAPTCHA_PATH.'";</ script>';
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/kcaptcha.js"></script>';
$html .= "\n".'<fieldset id="captcha" class="'.$class.'">';
$html .= "\n".'<legend><label for="captcha_key">Prevent automatic registration</label></legend>';
if (is_mobile()) $html .= '<audio id="captcha_audio" controls></audio>';
//$html .= "\n".'<img src="#" alt="" id="captcha_img">';
$html .= "\n".'<img src="'.G5_CAPTCHA_URL.'/img/dot.gif" alt="" id="captcha_img">';
$html .= '<input type="text" name="captcha_key" id="captcha_key" required class="captcha_box required" size="6" maxlength="6">';
if (!is_mobile()) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>Listen to numbers</button>';
$html .= "\n".'<button type="button" id="captcha_reload"><span></span>Refresh</button>';
$html .= "\n".'<span id="captcha_info">Enter the numbers in order to prevent automatic registration</span>';
$html .= "\n".'</fieldset>';
return $html;
}
// 캡챠 HTML 코드 출력 # 일어
function captcha_html_jp($class="captcha")
{
if(is_mobile())
$class .= ' m_captcha';
$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
//$html .= "\n".'<script>var g5_captcha_path = "'.G5_CAPTCHA_PATH.'";</ script>';
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/kcaptcha.js"></script>';
$html .= "\n".'<fieldset id="captcha" class="'.$class.'">';
$html .= "\n".'<legend><label for="captcha_key">自動登録防止</label></legend>';
if (is_mobile()) $html .= '<audio id="captcha_audio" controls></audio>';
//$html .= "\n".'<img src="#" alt="" id="captcha_img">';
$html .= "\n".'<img src="'.G5_CAPTCHA_URL.'/img/dot.gif" alt="" id="captcha_img">';
$html .= '<input type="text" name="captcha_key" id="captcha_key" required class="captcha_box required" size="6" maxlength="6">';
if (!is_mobile()) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>数字音声を聞く</button>';
$html .= "\n".'<button type="button" id="captcha_reload"><span></span>リフレッシュ</button>';
$html .= "\n".'<span id="captcha_info">自動登録を防止するための数字を順に入力してください。</span>';
$html .= "\n".'</fieldset>';
return $html;
}
// 캡챠 HTML 코드 출력 # 중문
function captcha_html_cn($class="captcha")
{
if(is_mobile())
$class .= ' m_captcha';
$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/kcaptcha.js"></script>';
$html .= "\n".'<fieldset id="captcha" class="'.$class.'">';
$html .= "\n".'<legend><label for="captcha_key">防止自动注册</label></legend>';
if (is_mobile()) $html .= '<audio id="captcha_audio" controls></audio>';
//$html .= "\n".'<img src="#" alt="" id="captcha_img">';
$html .= "\n".'<img src="'.G5_CAPTCHA_URL.'/img/dot.gif" alt="" id="captcha_img">';
$html .= '<input type="text" name="captcha_key" id="captcha_key" required class="captcha_box required" size="6" maxlength="6">';
if (!is_mobile()) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>听数字</button>';
$html .= "\n".'<button type="button" id="captcha_reload"><span></span>刷新</button>';
$html .= "\n".'<span id="captcha_info">请输入数字以防止自动注册</span>';
$html .= "\n".'</fieldset>';
return $html;
}