The Razor mediator allows for some formatting of datetime fields when they are rendered. For example,
@Metadata.EventDate.ToString("MMMM")
will render out the full text of the month. However, for translated sites I need to be able to select the language of the month it produces, ie. "janvier" instead of "January".
I've tried passing in a culture info indicator:
@{
var culture = new CultureInfo("fr-FR");
var month = Metadata.EventDate.ToString("MMMM", culture);
}
and doing the same in a single line:
@{
var month = Metadata.EventDate.ToString("MMMM", new CultureInfo("fr-FR"))
}
However neither option passes the validation in order to save my TBB. I also haven't been able to find any mention of this scenario in the Razor Mediator documentation.
Is there a way to define what language the month in a datetime will be displayed in?