Markus, Fabian, and everyone:

This e-mailing contains the first of two required patches, since I am not certain that everyone's e-mail client can handle more than one attachment to one message.

This is the patch to SMW_DV_Time.php itself. The internationalization support consists of various calls to functions newly invented for the various language files. A combined patch for all the affected language files will follow under separate cover.

Not all symbols are supported in all languages. This is especially true of Korean and Chinese. Language support in Russian is provided for all symbols for which Russian equivalents exist; the JD and MJD symbols are not translated but are used as they appear in English.

With this internationalization support, a user writing in, say, German can annotate the date of the assassination of Julius Caesar as "15 März 44 vChr", or in the alternative, "15 März 44 vdZ." This will process properly, and the proleptic Gregorian printout will appear in the tooltip as either "13 März 43 vChr" or "13 März 43 vdZ" consistent with the original annotation symbol used. For the non-German speakers receiving this e-mail, "vChr" translates as "BC" and "vdZ" translates as "BCE".

This completes the major development work on SMW_DV_Time.php. I will now attempt to move this file into later versions of SMW.

Temlakos
--- ../SemanticMediaWiki-lng/SMW_DV_Time.php    2009-08-14 15:34:56.000000000 
-0400
+++ ./SMW_DV_Time.php   2009-08-14 19:14:06.000000000 -0400
@@ -18,7 +18,7 @@
  *
  * Currently, the twelve-hour clock annotations "am" and "pm", and the calendar
  * symbols "BC", "AD", "He", "Gr", "Jl", "JD", "MJD", "AM", and "OS" are 
supported,
- * but not (yet) localised to other languages. Civilian and military time-zone 
monikers
+ * and localised to most SMW-supported languages. Civilian and military 
time-zone monikers
  * are also supported; these do not require internationalization, except 
perhaps into
  * Cyrillic. Cyrillic support will be added when deemed necessary.
  *
@@ -100,7 +100,6 @@
  *
  * @todo Add support for additional calendar models (mainly requires 
conversion algorithms and
  * internationalization support).
- * @todo Internationalise the treatment of AD, BC, PM, AM. Add more formats 
(p.m. or BCE).
  * @todo Try to reuse more of MediaWiki's records, e.g. to obtain month names 
or to
  * format dates. The problem is that MW is based on SIO timestamps that don't 
extend to
  * very ancient or future dates, and that MW uses PHP functions that are bound 
to UNIX time.
@@ -219,8 +218,8 @@
                $filteredvalue = $value; //value without time definition and 
further abbreviations like PM or BC
 
                //browse string for special abbreviations referring to time 
like am, pm
-               if(preg_match("/\040[ap]m/u", $filteredvalue, $match)){
-                 $this->m_timeannotation = strtolower($match[0]);
+               if(preg_match($smwgContLang->getRgxAmPm(), $filteredvalue, 
$match)){
+                 $this->m_timeannotation = 
$smwgContLang->findAmPm(trim($match[0]));
                  $regexp = "/(\040|T){0,1}".str_replace("+", "\+", 
$match[0])."(\040){0,1}/u"; //delete pm/am, preceding and following chars
                  $filteredvalue = preg_replace($regexp,'', $filteredvalue); 
//value without am/pm
                }
@@ -237,8 +236,8 @@
 
                //browse string for special abbreviations referring to year 
like AD, BC, and OS
                $is_yearbc = false;
-               if(preg_match("/(A[DM]|BC(E)?|CE|Gr|He|Jl|(M)?JD|OS)/u", 
$filteredvalue, $match)){
-                       $this->m_pref = $match[0];
+               if(preg_match($smwgContLang->getRgxCalendar(), $filteredvalue, 
$match)){
+                       $this->m_pref = $smwgContLang->findCalendar($match[0]);
                        if (($this->m_pref == 'BC') || ($this->m_pref == 
'BCE')) {
                                $is_yearbc = true;
                        }
@@ -779,9 +778,9 @@
                if ($this->m_gregvalue === false) {
                        //MediaWiki date function is not applicable any more 
(no support for BC Dates)
                        if ($this->m_year > 0) {
-                               $this->m_gregvalue = 
number_format($this->m_year, 0, '.', '') . ((($this->m_pref == 'AD') || 
($this->m_pref == 'CE')) ? (' ' . $this->m_pref) : '');
+                               $this->m_gregvalue = 
number_format($this->m_year, 0, '.', '') . ((($this->m_pref == 'AD') || 
($this->m_pref == 'CE')) ? (' ' . $smwgContLang->getCalendar($this->m_pref)) : 
'');
                        } else {
-                               $this->m_gregvalue = 
number_format(-($this->m_year), 0, '.', '') . (($this->m_pref == 'BCE') ? ' 
BCE' : ' BC'); // note: there should be no digits after the comma anyway
+                               $this->m_gregvalue = 
number_format(-($this->m_year), 0, '.', '') . (($this->m_pref == 'BCE') ? ' ' . 
$smwgContLang->getCalendar('BCE') : ' ' . $smwgContLang->getCalendar('BC')); // 
note: there should be no digits after the comma anyway
                        }
                        if ($this->m_month) {
                                $this->m_gregvalue =  
$smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_gregvalue;
@@ -800,9 +799,9 @@
                if ($this->m_julvalue === false) {
                        //MediaWiki date function is not applicable any more 
(no support for BC Dates)
                        if ($this->m_yearj > 0) {
-                               $this->m_julvalue = 
number_format($this->m_yearj, 0, '.', '') . ((($this->m_pref == 'AD') || 
($this->m_pref == 'CE')) ? (' ' . $this->m_pref) : '');
+                               $this->m_julvalue = 
number_format($this->m_yearj, 0, '.', '') . ((($this->m_pref == 'AD') || 
($this->m_pref == 'CE')) ? (' ' . $smwgContLang->getCalendar($this->m_pref)) : 
'');
                        } else {
-                               $this->m_julvalue = 
number_format(-($this->m_yearj), 0, '.', '') . (($this->m_pref == 'BCE') ? ' 
BCE' : ' BC'); // note: there should be no digits after the comma anyway
+                               $this->m_julvalue = 
number_format(-($this->m_yearj), 0, '.', '') . (($this->m_pref == 'BCE') ? ' ' 
. $smwgContLang->getCalendar('BCE') : ' ' . $smwgContLang->getCalendar('BC')); 
// note: there should be no digits after the comma anyway
                        }
                        if ($this->m_monthj) {
                                $this->m_julvalue =  
$smwgContLang->getMonthLabel($this->m_monthj) . " " . $this->m_julvalue;
@@ -819,7 +818,7 @@
        protected function makeHillelValue() {
                global $smwgContLang;
                if ($this->m_hvalue === false) {
-                       $this->m_hvalue = number_format($this->m_yearh, 0, '.', 
'') . ' He'; // note: there should be no digits after the comma anyway
+                       $this->m_hvalue = number_format($this->m_yearh, 0, '.', 
'') . ' ' . $smwgContLang->getCalendar('He'); // note: there should be no 
digits after the comma anyway
                        if ($this->m_monthh) {
                                $this->m_hvalue =  
$smwgContLang->getMonthLabelH($this->m_monthh) . " " . $this->m_hvalue;
                        }
@@ -835,7 +834,7 @@
        protected function makeAMValue() {
                global $smwgContLang;
                if ($this->m_amvalue === false) {
-                       $this->m_amvalue = number_format($this->m_yearam, 0, 
'.', '') . ' AM'; // note: there should be no digits after the comma anyway
+                       $this->m_amvalue = number_format($this->m_yearam, 0, 
'.', '') . ' ' . $smwgContLang->getCalendar('AM'); // note: there should be no 
digits after the comma anyway
                        if ($this->m_montham) {
                                $this->m_amvalue =  
$smwgContLang->getMonthLabelAM($this->m_montham) . " " . $this->m_amvalue;
                        }
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to