1 頁 (共 3 頁)

[問題]如何做一個可選擇多國語言的介面?

發表於 : 2004-04-21 18:34
xavierlau
希望有人能解答.

發表於 : 2004-04-21 19:48
messagebox
http://onlyou.org/bbs/

你是說這樣嗎

[問題]我好想做這個,怎做?

發表於 : 2004-04-21 19:58
xavierlau
messagebox 寫:http://onlyou.org/bbs/

你是說這樣嗎

[問題] 被delete 留言了~~~

發表於 : 2004-04-21 20:07
xavierlau
我再想問,如何加一項及一個oicq的icon,在會員註冊及修改的頁面?
希望不要被delete :x

發表於 : 2004-04-21 20:16
messagebox
噗~~~第一次看到有人貼文章是把想表達的文字放在主題~~

在BBS或許會引人注意~~但在PHPBB裡~~根本看不到你那個小小的主題~~

害我一直想說~~怎麼回了一個空白文章~~~是我猜對還是猜錯呢~~

怎麼做~~~用文字編輯軟體寫~~~大概就是這樣吧~~

要寫什麼??等興農牛終止連敗我在跟你說~

這裡開始是編輯的~~~~
用鍵盤做的~~~我上面打的很清楚吧~~~

[閒聊]語言選擇

發表於 : 2004-04-21 20:36
xavierlau
http://onlyou.org/bbs/ <<<頭頂那個語言選擇,你怎做?

發表於 : 2004-04-21 21:25
jessie
哪裡有chinese simplified可下呀...

發表於 : 2004-04-21 22:00
messagebox
jessie 寫:哪裡有chinese simplified可下呀...
http://www.phpbb.com/downloads.php
中間有一大串喔

發表於 : 2004-04-21 23:59
sakamoto
是否可以講解一下上面的語系語法教學呢?

發表於 : 2004-04-22 00:23
godbless

發表於 : 2004-04-22 21:47
sakamoto
鼠哥...你的跟他的不太一樣耶....雖然這一種也不錯(我以前用過...)但是我就是想像上面的人兄一樣不用按go就可以自動切換的那一種.............^^;(不好意思..人很龜毛...)

發表於 : 2004-04-22 22:04
messagebox
當初是自己在測試UTF-8的編碼~~~
(想做個多國語言的討論風格)

才想到這樣做的~~
因為當初不知道有這種MOD~
所以就自己來了~~~

大致上是用COOKIE紀錄來推翻正常要顯示的~~~
判定標準為~~~
假如有拿到$_COOKIE['lang']就設為這個
假如有拿到$_GET['lang']就再推翻掉COOKIE的
假如有拿到$_POST['lang']就再推翻掉GET的

也因為當初是自己想要用的~~~
所以~~放棄了比較容易修改~~~直接include'./includes/functions_selects.php';
而選擇自己抓有哪些語系~~~
其實不要有GO那個~~~

一定要不能用language_select()這函式來顯示選擇語言的下拉選單~~

改天有空我在整理一下~~~放出來給大家玩~~~

發表於 : 2004-04-22 23:39
sakamoto
messagebox兄!我比較喜歡你的做法啦..所以才會想要請教一下...(鼠哥..不好意思呢..你的也不錯啦..只是我比較龜毛...^^;)
嗯恩~就等你的教學了~(y)

發表於 : 2004-04-23 00:11
messagebox
[php]<?php
##########################################################
## ##
## 沒有名字的外掛 by 包子 <sysop@onlyou.org> (04-04-23) ##
## ##
##########################################################
#
#-----[ OPEN ]------------------------------------------
#
./includes/functions.php

#
#-----[FIND]------------------------------------------
#
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx)) )

#
#-----[ADD BEFORE]------------------------------------------
#
//點子(標記用)
$board_config['default_lang'] = ($_COOKIE['lang']) ? $_COOKIE['lang'] : $board_config['default_lang'];
$board_config['default_lang'] = ($_GET['lang']) ? $_GET['lang'] : $board_config['default_lang'];
$board_config['default_lang'] = ($_POST['lang']) ? $_POST['lang'] : $board_config['default_lang'];
setcookie("lang",$board_config['default_lang']);
//點子(標記用)

#
#-----[FIND]------------------------------------------
#
if ( $theme = setup_style($userdata['user_style']) )
{
return;
}

#
#-----[ADD BEFORE]------------------------------------------
#
//點子(標記用)
$userdata['user_style'] = ($_COOKIE['style']) ? $_COOKIE['style'] : $userdata['user_style'];
$userdata['user_style'] = ($_GET['style']) ? $_GET['style'] : $userdata['user_style'];
$userdata['user_style'] = ($_POST['style']) ? $_POST['style'] : $userdata['user_style'];
setcookie("style",$userdata['user_style']);
//點子(標記用)

#
#-----[FIND]------------------------------------------
#
$theme = setup_style($board_config['default_style']);

//
// Mozilla navigation bar
// Default items that should be valid on all pages.
// Defined here to correctly assign the Language Variables
// and be able to change the variables within code.
//

#
#-----[ADD BEFORE]------------------------------------------
#
//點子(標記用)
$board_config['default_style'] = ($_COOKIE['style']) ? $_COOKIE['style'] : $board_config['default_style'];
$board_config['default_style'] = ($_GET['style']) ? $_GET['style'] : $board_config['default_style'];
$board_config['default_style'] = ($_POST['style']) ? $_POST['style'] : $board_config['default_style'];
setcookie("style",$board_config['default_style']);
//點子(標記用)

#
#-----[ OPEN ]------------------------------------------
#
./includes/page_header.php

#
#-----[FIND]------------------------------------------
#
$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],

#
#-----[ADD BEFORE]------------------------------------------
#

//點子(標記用)
//LANG
$get_lang = array();

$dir=opendir('./language');

while ( $file = readdir($dir) ){
if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath('./language/' . $file)) && !is_link(@phpbb_realpath('./language/' . $file)))
{
$filename = trim(str_replace("lang_", "", $file));
$displayname = preg_replace("/^(.*?)_(.*)$/", "\\\1 [ \\\2 ]", $filename);
$displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\\1 - \\\2 ]", $displayname);
$get_lang[$displayname] = $filename;
}
}
closedir($dir);

@asort($lang);
@reset($lang);

$lang_select = '<form name="idea_lang" method="POST" action="'.$_SERVER["REQUEST_URI"].'"><select name="lang" onchange="document.idea_lang.submit();">';
while ( list($displayname, $filename) = @each($get_lang) ){
$selected = ( strtolower($board_config['default_lang']) == strtolower($filename) ) ? ' selected="selected"' : '';
$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
}
$lang_select .= '</select></form>';

//STYLE
$chk_style = ($userdata['user_style'])? $userdata['user_style'] : $board_config['default_style'];
$chk_style = ($_COOKIE['style']) ? $_COOKIE['style'] : $chk_style;
$chk_style = ($_GET['style']) ? $_GET['style'] : $chk_style;
$chk_style = ($_POST['style']) ? $_POST['style'] : $chk_style;
$sql = "SELECT themes_id, style_name FROM " . THEMES_TABLE . " ORDER BY template_name, themes_id";
if ( !($result = $db->sql_query($sql)) ){message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql);}

$style_select = '<form name="idea_style" method="POST" action="'.$_SERVER["REQUEST_URI"].'"><select name="style" onchange="document.idea_style.submit();">>';
while ( $row = $db->sql_fetchrow($result) ){
$selected = ( $row['themes_id'] == $chk_style ) ? ' selected="selected"' : '';
$style_select .= '<option value="' . $row['themes_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
}

$style_select .= "</select></form>";
//點子(標記用)

#
#-----[FIND]------------------------------------------
#
'L_USERNAME' => $lang['Username'],
'L_PASSWORD' => $lang['Password'],

#
#-----[ADD BEFORE]------------------------------------------
#
//點子
'LANGUAGE_SELECT' => $lang_select,
'STYLE_SELECT' => $style_select,
//點子

#
#-----[ OPEN ]------------------------------------------
#
./templates/subSilver/overall_header.tpl

#
#-----[FIND]------------------------------------------
#
<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu"> <a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>   <a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>   <a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a> </span>

#
#-----[ADD AFTER]------------------------------------------
#

{LANGUAGE_SELECT}{STYLE_SELECT}


?>[/php]

最後面那個看你喜歡放在哪就放在哪吧~~~
我是亂找位置放的~~~
\r
附帶一點~~~我覺得~~沒有把語系檔用UTF-8
感覺上~~~
好像也沒用耶~~~

測試網址
http://onlyou.org/bbs/

剛剛做了一點小修正~~~04-04-23 00:53:04

發表於 : 2004-04-23 08:48
sakamoto
嗯...沒錯.這就是針對使用utf-8的使用者而言有用....一般的語系檔只要一做變換我想亂碼就出現一堆了....