How to detect which language of summary.php is using?

How to detect which language of summary.php is using?

Postby hhtmp88 on Thu Jun 14, 2007 11:48 pm

Dear all,

The following codes can be find in:
<LT directory>/templates/summary/header.template

=========== English menu ==============
<ul class="menuTop">
<li class="menuOption"><a href="summary.php?op=Summary">{$locale->tr("summary")}</a></li>
<li class="menuOption"><a href="summary.php?op=Register&amp;start=1">{$locale->tr("register")}</a></li>
<li class="menuOption"><a href="summary.php?op=PostList">{$locale->tr("posts")}</a></li>
<li class="menuOption"><a href="summary.php?op=BlogList">{$locale->tr("blogs")}</a></li>
<li class="menuOption"><a href="summary.php?op=UserList">{$locale->tr("users")}</a></li>
</ul>
=================================

-> my question is: How to detect which language of summary.php is using?
-> and switch the above English Menu into the following Chinese Menu or vice versa?


=========== Chinese Menu ================
<ul class="menuTop">
<li class="menuOption"><a href="summary.php?op=Summary&lang=zh_CN">{$locale->tr("summary")}</a></li>
<li class="menuOption"><a href="summary.php?op=Register&amp;start=1&lang=zh_CN">{$locale->tr("register")}</a></li>
<li class="menuOption"><a href="summary.php?op=PostList&lang=zh_CN">{$locale->tr("posts")}</a></li>
<li class="menuOption"><a href="summary.php?op=BlogList&lang=zh_CN">{$locale->tr("blogs")}</a></li>
<li class="menuOption"><a href="summary.php?op=UserList&lang=zh_CN">{$locale->tr("users")}</a></li>
</ul>
=====================================

Thanks for any kind of help!

Rgds,
JMY(晉明夷)
http://mfYoga.org -- Mindfulness Yoga Association |瑜伽班 |瑜伽課程 |瑜伽訓練班 |靜坐班
http://jm3ime.com -- JinMing3-Key Chinese Input Method 晉明三鍵輸入法
hhtmp88
 
Posts: 61
Joined: Wed Mar 21, 2007 3:15 am

Postby phunkphorce on Fri Jun 15, 2007 12:37 pm

Within the template you can query the language currently loaded via the $locale object: http://www.lifetype.net/api/class_locale.php so for example $locale->getLanguageId() will get you "cn", "en" and so on.

But I don't understand what you mean when you say "switch the English Menu into Chinese"...
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby hhtmp88 on Sat Jun 16, 2007 9:23 am

Thanks phunkphorce for your great information!

Will try it out!


I am going to set a blog site with 3 main languages, i.e, English (en), Traditional Chinese (zh_TW), and Simplified Chinese (zh_CN) and allow visitors or users to switch between these three languages by clicking the corresponding icon images.

-> this requires also the top menu to switch accordingly too!


Rgds,
JMY(晉明夷)
http://mfYoga.org -- Mindfulness Yoga Association |瑜伽班 |瑜伽課程 |瑜伽訓練班 |靜坐班
http://jm3ime.com -- JinMing3-Key Chinese Input Method 晉明三鍵輸入法
hhtmp88
 
Posts: 61
Joined: Wed Mar 21, 2007 3:15 am


Return to Templates

cron