[問題]如何做一個可選擇多國語言的介面?
版主: 版主管理群
版面規則
本區是討論關於 phpBB 2.0.X 架設安裝上的問題,只要有安裝任何外掛,請到外掛討論相關版面按照公告格式發表。
(發表文章請按照公告格式發表,違者砍文)
本區是討論關於 phpBB 2.0.X 架設安裝上的問題,只要有安裝任何外掛,請到外掛討論相關版面按照公告格式發表。
(發表文章請按照公告格式發表,違者砍文)
[問題]如何做一個可選擇多國語言的介面?
希望有人能解答.
[問題] 被delete 留言了~~~
我再想問,如何加一項及一個oicq的icon,在會員註冊及修改的頁面?
希望不要被delete
希望不要被delete
-
- 竹貓忠實會員
- 文章: 981
- 註冊時間: 2003-02-24 23:34
噗~~~第一次看到有人貼文章是把想表達的文字放在主題~~
在BBS或許會引人注意~~但在PHPBB裡~~根本看不到你那個小小的主題~~
害我一直想說~~怎麼回了一個空白文章~~~是我猜對還是猜錯呢~~
怎麼做~~~用文字編輯軟體寫~~~大概就是這樣吧~~
要寫什麼??等興農牛終止連敗我在跟你說~
這裡開始是編輯的~~~~
用鍵盤做的~~~我上面打的很清楚吧~~~
在BBS或許會引人注意~~但在PHPBB裡~~根本看不到你那個小小的主題~~
害我一直想說~~怎麼回了一個空白文章~~~是我猜對還是猜錯呢~~
怎麼做~~~用文字編輯軟體寫~~~大概就是這樣吧~~
要寫什麼??等興農牛終止連敗我在跟你說~
這裡開始是編輯的~~~~
用鍵盤做的~~~我上面打的很清楚吧~~~
最後由 messagebox 於 2004-04-21 21:00 編輯,總共編輯了 1 次。
[閒聊]語言選擇
http://onlyou.org/bbs/ <<<頭頂那個語言選擇,你怎做?
-
- 竹貓忠實會員
- 文章: 981
- 註冊時間: 2003-02-24 23:34
外掛問題區發問格式就在這裡,請務必一定照著格式來~!
你不照著規則來,就算是神也搞不清楚你的問題在哪裡!
新手問問題不是罪惡
罪惡的是自己沒有先做好本分和功課,說話的口氣也不好,再加上態度有好像我們這群人欠你多少似的~~!!
竹貓星球發問規則:
http://phpbb-tw.net/phpbb/viewtopic.php?t=16149
發問比率最高的句子翻譯:
Please ensure both the install/ and contrib/ directories are deleted
請確認install和contrib資料夾已被刪除(奇怪,翻一下英漢字典有這麼困難嗎)
你不照著規則來,就算是神也搞不清楚你的問題在哪裡!
新手問問題不是罪惡
罪惡的是自己沒有先做好本分和功課,說話的口氣也不好,再加上態度有好像我們這群人欠你多少似的~~!!
竹貓星球發問規則:
http://phpbb-tw.net/phpbb/viewtopic.php?t=16149
發問比率最高的句子翻譯:
Please ensure both the install/ and contrib/ directories are deleted
請確認install和contrib資料夾已被刪除(奇怪,翻一下英漢字典有這麼困難嗎)
-
- 竹貓忠實會員
- 文章: 981
- 註冊時間: 2003-02-24 23:34
當初是自己在測試UTF-8的編碼~~~
(想做個多國語言的討論風格)
才想到這樣做的~~
因為當初不知道有這種MOD~
所以就自己來了~~~
大致上是用COOKIE紀錄來推翻正常要顯示的~~~
判定標準為~~~
假如有拿到$_COOKIE['lang']就設為這個
假如有拿到$_GET['lang']就再推翻掉COOKIE的
假如有拿到$_POST['lang']就再推翻掉GET的
也因為當初是自己想要用的~~~
所以~~放棄了比較容易修改~~~直接include'./includes/functions_selects.php';
而選擇自己抓有哪些語系~~~
其實不要有GO那個~~~
一定要不能用language_select()這函式來顯示選擇語言的下拉選單~~
改天有空我在整理一下~~~放出來給大家玩~~~
(想做個多國語言的討論風格)
才想到這樣做的~~
因為當初不知道有這種MOD~
所以就自己來了~~~
大致上是用COOKIE紀錄來推翻正常要顯示的~~~
判定標準為~~~
假如有拿到$_COOKIE['lang']就設為這個
假如有拿到$_GET['lang']就再推翻掉COOKIE的
假如有拿到$_POST['lang']就再推翻掉GET的
也因為當初是自己想要用的~~~
所以~~放棄了比較容易修改~~~直接include'./includes/functions_selects.php';
而選擇自己抓有哪些語系~~~
其實不要有GO那個~~~
一定要不能用language_select()這函式來顯示選擇語言的下拉選單~~
改天有空我在整理一下~~~放出來給大家玩~~~
-
- 竹貓忠實會員
- 文章: 981
- 註冊時間: 2003-02-24 23:34
[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
##########################################################
## ##
## 沒有名字的外掛 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