aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwangen <jwangen>2002-10-30 05:03:47 +0000
committerjwangen <jwangen>2002-10-30 05:03:47 +0000
commit0bc96facfc2c2e021dde81984e6a67dbb836367f (patch)
tree1d67aee27b3c0ff4943807825c32f9db5ecb5863
parent3488e5254e016de0d491ad6ed9b842641692c08b (diff)
downloadphpicalendar-0bc96facfc2c2e021dde81984e6a67dbb836367f.tar.gz
phpicalendar-0bc96facfc2c2e021dde81984e6a67dbb836367f.tar.bz2
phpicalendar-0bc96facfc2c2e021dde81984e6a67dbb836367f.zip
updated search to support localization, added localization vars to
english and japanese, updated rss files to find their own $default_path
-rw-r--r--config.inc.php4
-rw-r--r--functions/ical_parser.php2
-rw-r--r--languages/english.inc.php33
-rw-r--r--languages/japanese.inc.php46
-rw-r--r--rss/index.php2
-rw-r--r--rss/rss.php1
-rw-r--r--search.php124
-rw-r--r--sidebar.php2
8 files changed, 131 insertions, 83 deletions
diff --git a/config.inc.php b/config.inc.php
index 78eaec4..3ee4cb8 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -10,7 +10,7 @@ $calendar_path = './calendars'; // Path to directory with calendars
$default_view = 'day'; // Default view for calendars = 'day', 'week', 'month', 'year'
$minical_view = 'current'; // Where do the mini-calendars go when clicked? = 'day', 'week', 'month', 'current'
$default_cal = 'Home'; // Exact filename of calendar without .ics
-$language = 'English'; // Language support - 'English', 'Polish', 'German', 'French', 'Dutch', 'Danish', 'Italian', 'Japanese', 'Norwegian', 'Spanish', 'Swedish', 'Portuguese'
+$language = 'english'; // Language support - 'English', 'Polish', 'German', 'French', 'Dutch', 'Danish', 'Italian', 'Japanese', 'Norwegian', 'Spanish', 'Swedish', 'Portuguese'
$week_start_day = 'Sunday'; // Day of the week your week starts on
$day_start = '0700'; // Start time for day grid
$gridLength = '15'; // Grid distance in minutes for day view, multiples of 15 preferred
@@ -24,7 +24,7 @@ $default_path = 'http://www.example.com/phpicalendar'; // The HTTP URL to the
$tmp_dir = '/tmp'; // The temporary directory on your system (/tmp is fine for UNIXes including Mac OS X)
// Yes/No questions --- 'yes' means Yes, anything else means no. 'yes' must be lowercase.
-$save_parsed_cals = 'yes'; // Recommended 'yes'. Saves a copy of the cal in /tmp after it's been parsed. Improves performence.
+$save_parsed_cals = 'no'; // Recommended 'yes'. Saves a copy of the cal in /tmp after it's been parsed. Improves performence.
$use_sessions = 'no'; // This has not yet been implemented.
$display_custom_goto = 'no'; // In the 'Jump To' box, display the custom 'go to day' box.
$display_ical_list = 'yes'; // In the 'Jump To' box, display the pop-up menu with the list of all calendars in the $calendar_path directory.
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 1d456ba..62aa964 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -232,7 +232,7 @@ if ($parse_file) {
case 'MINUTELY': $freq_type = 'minute'; break;
case 'SECONDLY': $freq_type = 'second'; break;
}
- $master_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = ucfirst($freq_type);
+ $master_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = strtolower($val);
break;
case 'COUNT':
$count = $val;
diff --git a/languages/english.inc.php b/languages/english.inc.php
index d73792c..9fd916a 100644
--- a/languages/english.inc.php
+++ b/languages/english.inc.php
@@ -45,10 +45,9 @@ $goweek_lang = 'Go to This Week';
$gomonth_lang = 'Go to This Month';
$goyear_lang = 'Go to This Year';
-// new in 0.8 -------------
$search_lang = 'Search'; // the verb
$results_lang = 'Search Results';
-$query_lang = 'Query: '; // will be followed by the search query
+$query_lang = 'Query'; // will be followed by the search query
$no_results_lang = 'No events found';
$goprint_lang = 'Printer Friendly';
@@ -56,7 +55,6 @@ $time_lang = 'Time';
$summary_lang = 'Summary';
$description_lang = 'Description';
-// RSS text for 0.8
$this_site_is_lang = 'This site is';
$no_events_day_lang = 'No events today.';
$no_events_week_lang = 'No events this week.';
@@ -65,7 +63,34 @@ $rss_day_date = 'g:i A'; // Lists just the time
$rss_week_date = '%b %e'; // Lists just the day
$rss_month_date = '%b %e'; // Lists just the day
$rss_language = 'en-us';
-// -------------------------
+
+// new in 0.9 ----------------------
+
+$search_took_lang = 'Search took %s seconds';
+$recurring_event_lang = 'Recurring event';
+$exception_lang = 'Exception';
+$no_query_lang = 'No query given';
+
+// $format_recur, items enclosed in % will be substituted with variables
+$format_recur_lang['delimiter'] = ', '; // ie, 'one, two, three'
+
+$format_recur_lang['yearly'] = array('year','years'); // for these, put singular
+$format_recur_lang['monthly'] = array('month','months'); // and plural forms
+$format_recur_lang['weekly'] = array('week','weeks'); // these will be %freq%
+$format_recur_lang['daily'] = array('day','days'); // in the replacement below
+$format_recur_lang['hourly'] = array('hour','hours');
+$format_recur_lang['minutely'] = array('minute','minutes');
+$format_recur_lang['secondly'] = array('second','seconds');
+
+$format_recur_lang['start'] = 'Every %int% %freq% %for%'; // ie, 'Every 1 day until January 4' or 'Every 1 day for a count of 5'
+$format_recur_lang['until'] = 'until %date%'; // ie, 'until January 4'
+$format_recur_lang['count'] = 'for a count of %int%'; // ie, 'for 5 times'
+
+$format_recur_lang['bymonth'] = 'In months: %list%'; // ie, 'In months: January, February, March'
+$format_recur_lang['bymonthday'] = 'On dates: %list%'; // ie, 'On dates: 1, 2, 3, 4'
+$format_recur_lang['byday'] = 'On days: %list%'; // ie, 'On days: Mon, Tues, Wed, Thurs'
+
+// ---------------------------------
$daysofweek_lang = array ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
$daysofweekshort_lang = array ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
diff --git a/languages/japanese.inc.php b/languages/japanese.inc.php
index ba4f9c4..f577caa 100644
--- a/languages/japanese.inc.php
+++ b/languages/japanese.inc.php
@@ -53,10 +53,9 @@ $goweek_lang = '今週に移動';
$gomonth_lang = '今月に移動';
$goyear_lang = '今年に移動';
-// new in 0.8 -------------
$search_lang = '探す'; // the verb
$results_lang = 'サーチリザルト';
-$query_lang = '問い: '; // will be followed by the search query
+$query_lang = '問い'; // will be followed by the search query
$no_results_lang = '予定を見つけません。';
$goprint_lang = '印刷できる';
@@ -72,8 +71,35 @@ $no_events_month_lang = '今月は予定がありません';
$rss_day_date = 'g:i A'; // Lists just the time
$rss_week_date = '%b %e日'; // Lists just the day
$rss_month_date = '%b %e日'; // Lists just the day
-$rss_language = 'en-us';
-// -------------------------
+$rss_language = 'ja';
+
+// new in 0.9 ----------------------
+
+$search_took_lang = 'Search took %s seconds';
+$recurring_event_lang = 'Recurring event';
+$exception_lang = '特例';
+
+// $format_recur, items enclosed in % will be substituted with variables
+$format_recur_lang['delimiter'] = '、'; // ie, 'one, two, three'
+
+$format_recur_lang['yearly'] = array('年','年'); // for these, put singular
+$format_recur_lang['monthly'] = array('か月','か月'); // and plural forms
+$format_recur_lang['weekly'] = array('週','週'); // these will be %freq%
+$format_recur_lang['daily'] = array('日','日'); // in the replacement below
+$format_recur_lang['hourly'] = array('時間','時間');
+$format_recur_lang['minutely'] = array('分','分');
+$format_recur_lang['secondly'] = array('秒','秒');
+
+$format_recur_lang['start'] = '%int%%freq%毎に%for%'; // ie, 'Every 1 day until January 4' or 'Every 1 day for a count of 5'
+$format_recur_lang['until'] = '%date%まで'; // ie, 'until January 4'
+$format_recur_lang['count'] = 'for a count of %int%'; // ie, 'for 5 times'
+
+$format_recur_lang['bymonth'] = '月:%list%'; // ie, 'In months: January, February, March'
+$format_recur_lang['bymonthday'] = '幾日:%list%'; // ie, 'On dates: 1, 2, 3, 4'
+$format_recur_lang['byday'] = '週の日:%list%'; // ie, 'On days: Mon, Tues, Wed, Thurs'
+
+// ---------------------------------
+
$daysofweek_lang = array ('日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日');
$daysofweekshort_lang = array ('日','月','火','水','木','金','土');
@@ -85,12 +111,12 @@ $monthsofyearshort_lang = $monthsofyear_lang;
$timeFormat = 'g:i A';
// For date formatting, see note below
-$dateFormat_day = '%B %e日 %A';
-$dateFormat_week = '%B %e日';
-$dateFormat_week_list = '%b %e日 (%a)';
-$dateFormat_week_jump = '%b %e日';
-$dateFormat_month = '%Y年 %B';
-$dateFormat_month_list = '%B %e日 %A';
+$dateFormat_day = '%B%e日 %A';
+$dateFormat_week = '%B%e日';
+$dateFormat_week_list = '%b%e日(%a)';
+$dateFormat_week_jump = '%b%e日';
+$dateFormat_month = '%Y年%B';
+$dateFormat_month_list = '%B%e日 %A';
/*
Notes about dateFormat_*
diff --git a/rss/index.php b/rss/index.php
index 8944232..341d44c 100644
--- a/rss/index.php
+++ b/rss/index.php
@@ -3,7 +3,7 @@
define('BASE','../');
$current_view = "rssindex";
include(BASE.'functions/ical_parser.php');
-
+$default_path = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/rss/'));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
diff --git a/rss/rss.php b/rss/rss.php
index bdd8008..9efbdeb 100644
--- a/rss/rss.php
+++ b/rss/rss.php
@@ -2,6 +2,7 @@
define('BASE', '../');
include(BASE.'functions/ical_parser.php');
+$default_path = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/rss/'));
$start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
$end_week_time = $start_week_time + (6 * 25 * 60 * 60);
diff --git a/search.php b/search.php
index b85e3ca..c755d0c 100644
--- a/search.php
+++ b/search.php
@@ -44,7 +44,7 @@ $search_started = getmicrotime();
if ($search_valid) {
$format_search_arr = format_search($query);
if (!$format_search_arr[0]) {
- $formatted_search = '<b>No query given</b>';
+ $formatted_search = '<b>'.$no_query_lang.'</b>';
} else {
$formatted_search = $format_search_arr[0];
}
@@ -80,7 +80,7 @@ if ($search_valid) {
}
}
} else {
- $formatted_search = '<b>No query given</b>';
+ $formatted_search = '<b>'.$no_query_lang.'</b>';
}
$search_ended = getmicrotime();
@@ -137,7 +137,7 @@ $search_took = number_format(($search_ended-$search_started),3);
<td colspan="3" height="1"></td>
</tr>
<tr>
- <td colspan="3" class="G10B" align="center"><?php echo $query_lang.$formatted_search; ?></td>
+ <td colspan="3" class="G10B" align="center"><?php echo $query_lang.': '.$formatted_search; ?></td>
</tr>
<tr>
<td colspan="3" class="G10B">&nbsp;</td>
@@ -196,12 +196,13 @@ $search_took = number_format(($search_ended-$search_started),3);
echo "</tr>\n";
echo "<tr><td colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"10\"></td></tr>\n";
if (isset($val['exceptions'])) {
+ echo "<tr><td colspan=\"3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
foreach($val['exceptions'] as $val2) {
$key = $val2['date'];
$dayofmonth = strtotime ($key);
$dayofmonth = localizeDate ($dateFormat_day, $dayofmonth);
- echo "<tr><td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"1\"></td>\n";
- echo "<td align=\"left\" colspan=\"2\"><font class=\"V10\"><i>Exception:</i> <a class=\"ps3\" href=\"day.php?cal=$cal&getdate=$key\">$dayofmonth</a></font></td></tr>";
+ echo "<tr><td width=\"20\"><img src=\"images/spacer.gif\" width=\"20\" height=\"1\"></td>\n";
+ echo "<td align=\"left\" colspan=\"2\"><font class=\"V10\"><i>$exception_lang</i>: <a class=\"ps3\" href=\"day.php?cal=$cal&getdate=$key\">$dayofmonth</a></font></td></tr>";
echo "<tr><td colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"5\"></td></tr>\n";
if ($val2["event_text"]) {
@@ -223,24 +224,24 @@ $search_took = number_format(($search_ended-$search_started),3);
echo "<td align=\"left\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n";
echo "<tr>\n";
- echo "<td width=\"100\" class=\"G10BOLD\">$time_lang:</td>\n";
- echo "<td align=\"left\" class=\"G10B\">$event_start</td>\n";
+ echo "<td width=\"100\" class=\"V10\">$time_lang:</td>\n";
+ echo "<td align=\"left\" class=\"V10\">$event_start</td>\n";
echo "</tr>\n";
echo "<tr>\n";
- echo "<td valign=\"top\" width=\"100\" class=\"G10BOLD\">$summary_lang:</td>\n";
- echo "<td valign=\"top\" align=\"left\" class=\"G10B\">$event_text</td>\n";
+ echo "<td valign=\"top\" width=\"100\" class=\"V10\">$summary_lang:</td>\n";
+ echo "<td valign=\"top\" align=\"left\" class=\"V10\">$event_text</td>\n";
echo "</tr>\n";
if (isset($val2['recur'])) {
$recur = $val2['recur'];
echo "<tr>\n";
- echo "<td valign=\"top\" width=\"100\" class=\"G10BOLD\">Recurring event:</td>\n";
- echo "<td valign=\"top\" align=\"left\" class=\"G10B\">$recur</td>\n";
+ echo "<td valign=\"top\" width=\"100\" class=\"V10\">$recurring_event_lang:</td>\n";
+ echo "<td valign=\"top\" align=\"left\" class=\"V10\">$recur</td>\n";
echo "</tr>\n";
}
if ($val2["description"]) {
echo "<tr>\n";
- echo "<td valign=\"top\" width=\"100\" class=\"G10BOLD\">$description_lang:</td>\n";
- echo "<td valign=\"top\" align=\"left\" class=\"G10B\">$description</td>\n";
+ echo "<td valign=\"top\" width=\"100\" class=\"V10\">$description_lang:</td>\n";
+ echo "<td valign=\"top\" align=\"left\" class=\"V10\">$description</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
@@ -249,6 +250,7 @@ $search_took = number_format(($search_ended-$search_started),3);
echo "<tr><td colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"10\"></td></tr>\n";
}
}
+ echo "</table></td><tr>\n";
}
}
}
@@ -267,7 +269,7 @@ $search_took = number_format(($search_ended-$search_started),3);
<tr>
<td colspan="3" class="G10B" align="center">
<?php
- echo '<font class="V9G">Search took '.$search_took.' seconds</font><br><br>';
+ echo '<font class="V9G">'.sprintf($search_took_lang,$search_took).'</font><br><br>';
?>
</td>
</tr>
@@ -416,71 +418,65 @@ function search_boolean($needle_arr, $haystack) {
}
function format_recur($arr) {
- global $monthsofyearshort_lang, $daysofweekshort_lang;
- $freq = $arr['FREQ'].(($arr['INTERVAL'] == 1) ? ' ' : 's ');
+ global $format_recur_lang, $monthsofyear_lang, $daysofweek_lang;
+
+ $d = $format_recur_lang['delimiter'];
$int = $arr['INTERVAL'];
- if (isset($arr['COUNT'])) $times = $arr['COUNT'].' time'.(($arr['COUNT'] == 1) ? ' ' : 's ');
- if (isset($arr['UNTIL'])) $until = 'until '.$arr['UNTIL'].' ';
- $by = '';
+ $tmp = (($int == '1') ? 0 : 1);
+
+ $freq = $arr['FREQ'];
+ $freq = $format_recur_lang[$freq][$tmp];
+
+ if (isset($arr['COUNT'])) $for = str_replace('%int%',$arr['COUNT'],$format_recur_lang['count']);
+ elseif (isset($arr['UNTIL'])) $for = str_replace('%date%',$arr['UNTIL'], $format_recur_lang['until']);
+ else $for = '';
+
+ $print = $format_recur_lang['start'];
+ $print = str_replace('%int%', $int, $print);
+ $print = str_replace('%freq%', $freq, $print);
+ $print = str_replace('%for%', $for, $print);
+
if (isset($arr['BYMONTH'])) {
- $by .= 'on ';
- $count = count($arr['BYMONTH']);
- $last = $count - 1;
- if ($count == 1) {
- $month = $arr['BYMONTH'][0];
- $by .= $monthsofyearshort_lang[($month-1)];
- } else {
- foreach ($arr['BYMONTH'] as $key => $month) {
- if ($key == $last) $by .= $monthsofyearshort_lang[($month-1)];
- else $by .= $monthsofyearshort_lang[($month-1)].', ';
- }
+ $list = '';
+ $last = count($arr['BYMONTH']) - 1;
+ foreach ($arr['BYMONTH'] as $key => $month) {
+ if ($key == $last) $list .= $monthsofyear_lang[($month-1)];
+ else $list .= $monthsofyear_lang[($month-1)].$d;
}
- $by .= ' ';
+ $print .= '<br>'."\n";
+ $print .= str_replace('%list%', $list, $format_recur_lang['bymonth']);
}
if (isset($arr['BYMONTHDAY'])) {
- $by .= 'on ';
+ $list = '';
+ if ($arr['BYMONTHDAY'][(count($arr['BYMONTHDAY']) - 1)] == '0') unset($arr['BYMONTHDAY'][$last]);
$last = count($arr['BYMONTHDAY']) - 1;
- if ($arr['BYMONTHDAY'][$last] == '0') unset($arr['BYMONTHDAY'][$last]);
- $count = count($arr['BYMONTHDAY']);
- $last = $count - 1;
- if ($count == 1) {
- ereg('([\-]{0,1})([0-9]{1,2})',$arr['BYMONTHDAY'][0],$regs);
+ foreach ($arr['BYMONTHDAY'] as $key => $day) {
+ ereg('([\-]{0,1})([0-9]{1,2})',$day,$regs);
list($junk,$sign,$day) = $regs;
- $by .= $day;
- } else {
- foreach ($arr['BYMONTHDAY'] as $key => $day) {
- ereg('([\-]{0,1})([0-9]{1,2})',$day,$regs);
- list($junk,$sign,$day) = $regs;
- if ($key == $last) $by .= $day;
- else $by .= $day.', ';
- }
+ if ($key == $last) $list .= $day;
+ else $list .= $day.$d;
}
- $by .= ' ';
+ $print .= '<br>'."\n";
+ $print .= str_replace('%list%', $list, $format_recur_lang['bymonthday']);
}
+
if (isset($arr['BYDAY'])) {
- $by .= 'on ';
- $count = count($arr['BYDAY']);
- $last = $count-1;
- if ($count == 1) {
- ereg('([\-]{0,1})([0-9]{0,1})([A-Z]{2})',$arr['BYDAY'][0],$regs);
+ $list = '';
+ $last = count($arr['BYDAY']) - 1;
+ foreach ($arr['BYDAY'] as $key => $day) {
+ ereg('([\-]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs);
list($junk,$sign,$day_num,$day_txt) = $regs;
$num = two2threeCharDays($day_txt,false);
- if ($day_num != '') $by .= $day_num.' ';
- $by .= $daysofweekshort_lang[$num];
- } else {
- foreach ($arr['BYDAY'] as $key => $day) {
- ereg('([\-]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs);
- list($junk,$sign,$day_num,$day_txt) = $regs;
- $num = two2threeCharDays($day_txt,false);
- if ($day_num != '') $by .= $day_num.' ';
- if ($key == $last) $by .= $daysofweekshort_lang[$num];
- else $by .= $daysofweekshort_lang[$num].', ';
- }
+ if ($day_num != '') $list .= $day_num.' ';
+ if ($key == $last) $list .= $daysofweek_lang[$num];
+ else $list .= $daysofweek_lang[$num].$d;
}
- $by .= ' ';
+ $print .= '<br>'."\n";
+ $print .= str_replace('%list%', $list, $format_recur_lang['byday']);
}
- return 'Every '.$int.' '.$freq.$times.$until.$by;
+
+ return $print;
}
function getmicrotime() {
diff --git a/sidebar.php b/sidebar.php
index 0c4cf5b..cd3774a 100644
--- a/sidebar.php
+++ b/sidebar.php
@@ -6,7 +6,7 @@
$cal_displayname2 = $cal_displayname2 . "...";
}
- $search_box .= '<form action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\'Search\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\'Search\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" border=0 height="19" width="18" name="submit" value="Search"></form>';
+ $search_box .= '<form action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\''.$search_lang.'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$search_lang.'\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" border=0 height="19" width="18" name="submit" value="Search"></form>';
?>

© 2014-2024 Faster IT GmbH | imprint | privacy policy