Last modified: 2009-08-03 07:10:28 UTC
On displays of month names generated by SMW on my Dutch language wiki nothing appears. For example "31 2009 11:00:00" instead of "januari 31 2009 11:00:00". Dutch month names do show up on all non-semantic aspects of the wiki displays, such as history pages. Dutch month names also show up on Semantic Form input interfaces. Furthermore, in Semantic Forms, the correct (or last entered) month names shows, which means the data is stored, but SMW generates no month name for it. Semantic Forms has its own translation, for which Dutch month names work. The error message I get is Notice: Undefined offset: 0 in D:\Inetpub\wwwroot\WikiSemanticweb\extensions\SemanticMediaWiki\languages\SMW_Language.php on line 113 Where 0 is the monthnumber minus 1. SMW_Language.php line 113 is the return in: /** * Return the name of the month with the given number. */ function getMonthLabel($number) { return (($number>=1)&&($number<=12))?$this->m_months[(int)($number-1)]:''; } Is there something I should change on my system? Or can this be fixed on an upcoming release? Or both? Thanks! Lloyd Rutledge
I fixed this on my installation by adding the following month name table to the end of SMW_LanguageNl.php: protected $m_months = array( 0 => 'januari', 1 => 'februari', 2 => 'maart', 3 => 'april', 4 => 'mei', 5 => 'juni', 6 => 'juli', 7 => 'augustus', 8 => 'september', 9 => 'oktober', 10 => 'november', 11 => 'december' ); Is this the right place for this table? -Lloyd
Yes, this is fine. However, I am surprised that you need to add the numeric keys explicitly. The definition array('januari', 'februari', ..., 'december') does the same thing on my machine. This seems to be the reason for the original problem, too. Even without specific Dutch translations, you should be able to access the English month names. I guess that this is some PHP characteristic that we are not aware of yet, and that might cause problems in many other cases if we do not find a more generic solution.
P.S. Could you provide some details about your PHP distribution, version, and configuration?
According to the version special page, the PHP version is 5.2.6 (isapi)
Same problem, on PHP version 5.2.9 (Apache).
The problem was actually not in PHP: the general language file actually had no default month names at all, so no months appeared since the Dutch language file had none. I have now set the defaults properly and I have also included your above month name translations into the Dutch file. Is it true that the month names should be lowercase in Dutch? (Maybe I should actually make the whole check for month names case insensitive anyway)
Thanks for you effort, Markus. :-) It is true that month names are lowercase in Dutch. We're weird like that. ;-)