Date display depending upon language settings
Posted: Wed Jun 09, 2004 2:02 am
Hi, I have a site that I'm trying to integrate with the phpbb forums. This is itself is irrelevant but will explain a lot of the implanted code I will be talking about. 
Right now, we only have two languages... Japanese and English. What I want to do is to display Japanese formatted dates on those pages.
e.g. Wednesday, June 9 >>>> (Japanese Date Text)6月 9日(水曜日)
I have contemplated arrays, although I really don't know how to use them. I have contemplated just storing the values in the database, but, I'm not sure if that is the best way. (3 DB accesses per page load).
Right now, I have a little routine that looks like this. I'm trying to convert the output to japanese. The date function is a straightforward assignment right now which is perfect for English. [ (date("l, F d",$last_visited) ] But, for japanese...What to do?
I'm just looking for some suggestions on what is the best way to go. Not, someone to write my code for me... Unless you just want to that is. 
So, what do you think?
SteedVLX
I may be in more trouble than I thought. On preview, the Japanese above is converted to unicode values rather than the actual text. Hmmm.
Right now, we only have two languages... Japanese and English. What I want to do is to display Japanese formatted dates on those pages.
e.g. Wednesday, June 9 >>>> (Japanese Date Text)6月 9日(水曜日)
I have contemplated arrays, although I really don't know how to use them. I have contemplated just storing the values in the database, but, I'm not sure if that is the best way. (3 DB accesses per page load).
Right now, I have a little routine that looks like this. I'm trying to convert the output to japanese. The date function is a straightforward assignment right now which is perfect for English. [ (date("l, F d",$last_visited) ] But, for japanese...What to do?
Code: Select all
<?php
//
// This code must be included in each page requiring user authorization to access
//
define('IN_PHPBB', true);
$phpbb_root_path = '../forums/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
// Check for logged in status and set some non-forum specific environment stuff
//
if($userdata['session_logged_in'])
{
$last_visited = $userdata['user_lastvisit'];
$display_message = ('Welcome ' . $userdata['username'] . '! ' . 'あなたが最後の来られたのは ' . date("l, F d",$last_visited) . ' です。');
$site_root = ('http://www.chirowebjapan.com');
$forum_index = ($site_root . '/forums/index.php?sid=' . $userdata['session_id']);
$forum_logout_path = ($site_root . '/forums/login.php?logout=true&sid=' . $userdata['session_id']);
$user_new_message = $userdata['user_new_privmsg'];
$user_ip = $userdata['session_ip'];
$display_logout_btn = ('TRUE');
}
else
{
$display_message = ('Welcome to Chiroweb Japan. You are logged in as a Guest. Today is ' . gmdate("l. F d") . '.');
$site_root = ('http://www.chirowebjapan.com');
$forum_index = ($site_root . '/forums/index.php');
$display_logout_btn = ('FALSE');
}
?>So, what do you think?
SteedVLX
I may be in more trouble than I thought. On preview, the Japanese above is converted to unicode values rather than the actual text. Hmmm.