Here is a quick test program:
public static void main( String[] args )
{
Date date = Calendar.getInstance().getTime();
System.out.println("Months:");
printDate( "MMMM", "en", date );
printDate( "MMMM", "es", date );
printDate( "MMMM", "fr", date );
printDate( "MMMM", "de", date );
System.out.println("Days:");
printDate( "EEEE", "en", date );
printDate( "EEEE", "es", date );
printDate( "EEEE", "fr", date );
printDate( "EEEE", "de", date );
}
public static void printDate( String format, String locale, Date date )
{
System.out.println( locale + ": " + (new SimpleDateFormat( format, new Locale( locale ) )).format( date ) );
}
The output is:
Months:
en: September
es: septiembre
fr: septembre
de: September
Days:
en: Monday
es: lunes
fr: lundi
de: Montag
How can I control the capitalization of the names. For some reason the Spanish and French always seem to return names that start with a lowercase letter.
Not all languages share english capitalization rules. I guess you'd need to alter the data used by the API, but your non-english clients might not appreciate it...
about.com on french capitalization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With