Option 1:
You can override DateTimeFormatInfo.MonthNames and MonthGenitiveNames , as well as their respective AbbreviatedMonthNames and AbbreviatedMonthGenitiveNames .
These are simple 1-dimensional arrays of string[] and have public setters , which allows you to add your custom translations to CultureInfo:
When this property is set, the array must be one-dimensional and must have exactly 13 elements. Calendar objects contain calendars from 13 months. The first element (an element with a zero index) represents the first month of the year defined by the Calendar property.
If you set the MonthNames property, you must also set the MonthGenitiveNames property.
If the user template contains an MMMM format template, DateTime.ToString displays the MonthNames value instead of MMMM in the format template.
This property affects if the value of the Calendar property changes.
So you can change the sample code as follows:
// I am just using German Number representations for the example. // Use additional string Arrays to suit the abbrevated // and the Genetive names. // Replaye with whatever suits your needs. string[] monthNames = { "Eins", "Zwei", "Drei", "Vier", "Fรผnf", "Sechs", "Sieben", "Acht", "Neun", "Zehn", "Elf", "Zwรถlf", string.Empty }; // Assign each string Array to its corresponding property. // I am using the same Array here just as an example for // what is possible and because I am lazy... :-) ci.DateTimeFormat.MonthNames = monthNames; ci.DateTimeFormat.MonthGenitiveNames = monthNames; ci.DateTimeFormat.AbbreviatedMonthNames = monthNames; ci.DateTimeFormat.AbbreviatedMonthGenitiveNames = monthNames;
These names will be used along with your output format string, just as you want.
Each time you change the calendar, these overrides will be lost. Therefore, you need to make sure that you reassign custom values โโif you need it.
[Update] Option 2:
A more permanent approach might be to use the CultureAndRegionInfoBuilder class.
Defines a custom culture that is new or based on a different culture and country / region. A user culture can be installed on a computer and subsequently used by any application running on that computer.
You can either create a complete replacement for the "he-IL" culture version, or create a variant using only your custom translations or something in between.
Using this approach, you do not need to manually ensure that translations are performed after each Culture switch in the application, as in Option 1. After registering a new user culture, you can use it like any other CultureInfo.
Please note that your application will need administrative privileges to register a new user culture.
Creating a custom culture is not too complicated, as shown in the following code snippet.
Example from MSDN: CultureAndRegionInfoBuilder
The following example defines the user culture ru-US, representing Russian in the United States. In this example, the user culture, loading settings from the Russian (Russia) CultureInfo object and RegionInfo object, and then sets the number of CultureAndRegionInfoBuilder properties. An example registers a user culture, and then creates it and the current thread culture does.
using System; using System.Globalization; using System.Threading; public class Example { public static void Main() {