[pLog-svn] r3566 - in plog/trunk: class/locale locale

mark at devel.lifetype.net mark at devel.lifetype.net
Fri Jun 9 08:06:58 GMT 2006


Author: mark
Date: 2006-06-09 08:06:58 +0000 (Fri, 09 Jun 2006)
New Revision: 3566

Modified:
   plog/trunk/class/locale/locale.class.php
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/locale/locale_zh_TW.php
Log:
Fixed bug http://bugs.lifetype.net/view.php?id=949.

Now %b and %a date format modifier works for CJK language.

Modified: plog/trunk/class/locale/locale.class.php
===================================================================
--- plog/trunk/class/locale/locale.class.php	2006-06-09 06:38:19 UTC (rev 3565)
+++ plog/trunk/class/locale/locale.class.php	2006-06-09 08:06:58 UTC (rev 3566)
@@ -496,11 +496,20 @@
             // them before using
             $monthId    = (int)$timeStamp->getMonth();
             $monthStr   = $this->_messages["months"][$monthId-1];
+            if( !empty( $this->_messages["monthsshort"] ) )
+            	$shortMonthStr = $this->_messages["monthsshort"][$monthId-1];
+            else
+            	$shortMonthStr = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
+
             //print("monthstr: $monthStr");
             // and the same for the weekdays
             $weekdayId = $timeStamp->getWeekdayId();
             $weekday = $this->_messages["days"][$weekdayId];
-            
+            if( !empty( $this->_messages["weekdaysshort"] ) )
+            	$shortWeekday = $this->_messages["weekdaysshort"][$weekdayId];
+            else
+            	$shortWeekday = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3);
+
             include_once( PLOG_CLASS_PATH."class/data/Date.class.php" );
             // Get the unix time stamp 
             $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
@@ -530,9 +539,9 @@
 				$format = $this->_dateFormat;
 
             // now we can continue normally
-            $values["%a"] = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3 );
+            $values["%a"] = $shortWeekday;
 			$values["%A"] = $weekday;
-			$values["%b"] = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
+			$values["%b"] = $shortMonthStr;
 			$values["%B"] = $monthStr;
 			$values["%d"] = ($timeStamp->getDay() < 10) ? "0".$timeStamp->getDay() : $timeStamp->getDay();
 			$values["%e"] = intval($timeStamp->getDay());
@@ -636,19 +645,28 @@
             // them before using
             $monthId = gmdate( "n", $time );
             $monthStr   = $this->_messages["months"][$monthId-1];
+            if( !empty( $this->_messages["monthsshort"] ) )
+            	$shortMonthStr = $this->_messages["monthsshort"][$monthId-1];
+            else
+            	$shortMonthStr = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
+
             //print("monthstr: $monthStr");
             // and the same for the weekdays
             $weekdayId = gmdate( "w", $time );
             $weekday = $this->_messages["days"][$weekdayId];
+            if( !empty( $this->_messages["weekdaysshort"] ) )
+            	$shortWeekday = $this->_messages["weekdaysshort"][$weekdayId];
+            else
+            	$shortWeekday = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3);
             
             // if the user did not specify a format, let's use the default one
             if( $format == null )
                 $format = $this->_dateFormat;
 
             // now we can continue normally
-            $values["%a"] = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3 );
+            $values["%a"] = $shortWeekday;
             $values["%A"] = $weekday;
-            $values["%b"] = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
+            $values["%b"] = $shortMonthStr;
             $values["%B"] = $monthStr;
             $values["%d"] = gmdate( "d", $time );
             $values["%e"] = intval(gmdate( "d", $time ));

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2006-06-09 06:38:19 UTC (rev 3565)
+++ plog/trunk/locale/locale_en_UK.php	2006-06-09 08:06:58 UTC (rev 3566)
@@ -1047,4 +1047,8 @@
 $messages['error_invalid_subdomain'] = 'The subdomain name is not valid or it is not unique';
 $messages['register_blog_domain_help'] = 'Name and subdomain that you would like to use for your new blog';
 $messages['domain'] = 'Domain';
+
+$messages['monthsshort'] = Array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
+$messages['weekdaysshort'] = Array( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' );
+
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/locale_zh_TW.php
===================================================================
--- plog/trunk/locale/locale_zh_TW.php	2006-06-09 06:38:19 UTC (rev 3565)
+++ plog/trunk/locale/locale_zh_TW.php	2006-06-09 08:06:58 UTC (rev 3566)
@@ -1041,6 +1041,15 @@
 $messages['first_day_of_week_label'] = '每一週的開始';
 $messages['first_day_of_week_help'] = '在首頁月曆中的顯示方式。';
 
 
+$messages['help_subdomains_base_url'] = 'When subdomains are enabled, this base URL is used instead of base_url. Use {blogname} to get the blog name, {username} to get the name of the user owner of the blog and {blogdomain} to allow the user to specify any subdomain in order to generate a link to a blog. (e.g.. http://{blogname}.yourdomain.com)'; 
+
 $messages['registration_default_subject'] = 'LifeType 註冊確認';
 
+$messages['error_invalid_subdomain'] = 'The subdomain name is not valid or it is not unique';
+$messages['register_blog_domain_help'] = 'Name and subdomain that you would like to use for your new blog';
+$messages['domain'] = 'Domain';
+
+$messages['monthsshort'] = Array( '元', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二' );
+$messages['weekdaysshort'] = Array( '日', '一', '二', '三', '四', '五', '六' );
+
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list