the date filter and months

5 views
Skip to first unread message

Michael Connors

unread,
Feb 19, 2012, 2:09:58 AM2/19/12
to zotoni...@googlegroups.com
Hi,

I have been looking at the date filter, and erlydtl_dateformat.erl which is a port of PHPs date function according to the documentation online.

In PHP's date function, M returns shortened months in English. They start with a capital letter, they are always the first three letters and always in English.

Zotonic however, translates these shortened dates, and the results can often be useless do to duplications such as jui = juin, jui = juillet in French.

I think that if we are going to translate these, it would mak sense to translate them to something useful. Otherwise they should just not be translated at all.

My suggestion would be to add the following:

In l10n_date.erl:

%% @doc Provide localized short versions of month names.
monthname_short(1, Context) ->  ?__("Jan", Context);
monthname_short(2, Context) ->  ?__("Feb", Context);
monthname_short(3, Context) ->  ?__("Mar", Context);
monthname_short(4, Context) ->  ?__("Apr", Context);
monthname_short(5, Context) ->  ?__("May", Context);
monthname_short(6, Context) ->  ?__("Jun", Context);
monthname_short(7, Context) ->  ?__("Jul", Context);
monthname_short(8, Context) ->  ?__("Aug", Context);
monthname_short(9, Context) ->  ?__("Sep", Context);
monthname_short(10, Context) -> ?__("Oct", Context);
monthname_short(11, Context) -> ?__("Nov", Context);
monthname_short(12, Context) -> ?__("Dec", Context);
monthname_short(_, _Context) -> "???".

In erlydtl_dateformat.erl:

% Month, textual, 3 letters; e.g. 'Jan'
tag_to_value($M, {_,M,_}, _, Context) ->
   l10n_date:monthname_short(M, Context);

I would use the short names from here for French: http://www.loc.gov/acq/conser/conserhold/Mosabbr.htm

I am not sure if these are correct for the other languages.

Michael

Arjan Scherpenisse

unread,
Feb 19, 2012, 3:16:19 AM2/19/12
to zotoni...@googlegroups.com
Good suggestion, michael. I never got around to do this but have thought
of this before as well. I commited it to the master branch.

Note that translations need to be updated, so if you could (and other
translators!) send me a new .po for mod_l10n, that would be awesome.

Arjan

Michael Connors

unread,
Feb 19, 2012, 8:23:54 AM2/19/12
to zotoni...@googlegroups.com
I will add the French translations tomorrow morning and do a pull request on github.
Reply all
Reply to author
Forward
0 new messages