Re: Feature Request - Render months as words

Clemens Klein-Robbenhaar <crobbenhaar-S0/[email protected]> Thu, 10 Mar 2005 20:47:08 +0100
Newsgroups gmane.comp.web.zope.formulator.devel
Message-ID <[email protected]>
Hi Ian,

> I would like an option for rendering the Months as words rather than numbers. 
> (Jan, Feb, Mar or January, February, March) I can't see how to plug that into 
> the current code easily, without having the lists created at object creation 
> time. It seems like it would be a better idea to have the value created at 
> render time using a filter function, to allow for internationalization, 
> abbreviation, capitalization, etc...
> 
> I can do the work, if someone could suggest a good approach.

What You can try is to take a look at the "override_year_items"
of the DateTimeField class and how this is used to create a dropdown list
of years inside of the current range.

  It should be possible to add an analogous "override_month_items".

The problem I see is that one most probably wants to configure this, e.g.
translate the month names soemhow, etc. One possibility is to add much more
options to the ZMI of the DateTime field, e.g. a checkbox "want short month names",
a drop down for the language (?), etc etc etc. I admit that I dislike this option,
and I would vote against including a patch which includes a bunch of more fields.

Alternatively one could add a separate LinesField to the ZMI Form of the DateTimeField,
where the user can fill in the twelve month names. As one can create an override or tales
for that field it should be able to hook in anything wanted. One could e.g. call a script
which returns the translated month names. Thats a bit stupid, but its only one
(rather large :-/ ) extra field.
  The obvious drawback is that one has to insert the call to than script everywhere one
wants to have the translation.
  Oh, and yes, this would create the values statically, unless one fills in a value
for the "tales" of that hypothetical "month names" field. However I feel this is the
"Formulator" way to do it.

  Maybe someone else has a better idea?
  Maybe someone who did the current i18n has an idea how to solve the issue with translation
of the month names, without throwing in translation scripts?

Cheers anyway,
Clemens

P.S. note that there is still some ugly bug present in Formulator concerning the DateTimeField
and tales expressions to the start/end time; this sometimes creates odd errors which have
not been tracked down yet. (There are a few patches around, noone really solving that issue.
Unfortunatly I cannot find them in the archives yet :-( )
  Just to warn You in case You run into odd errors ... its maybe not Your fault ...