FINNISH: How to specify Unicode Date Formatter (like MMMM yyyy) to work in Finnish language
I've been using the MMMM yyyy unicode date time format http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns to generate Month Year. It works great in English and various Latin-based languages. But I'm getting a complaint that the dates are incorrect in Finnish.
The dates that are being generated (by NSDateFormatter on the Mac) are like this:
kesäkuuta 2014 toukokuuta 2014 huhtikuuta 2014
But they should be -- at least, according to a Finnish user of our software:
kesäkuu 2014 toukokuu 2014 huhtikuu 2014 …
I don't know Finnish, so I don't understand how the ta suffix works. Anyhow, does anybody know how to specify some variation on the date formatter that properly formats the date in Finnish, without messing up the rest of the languages?
(I've tried using MMM but that keeps the ta suffix but doesn't change it, AND is abbreviates the months in English, so that's not it.)
According to this IBM page, it looks like MMMM doesn't include the ta. http://publib.boulder.ibm.com/infocenter/forms/v3r5m0/index.jsp?topic=/com.ibm.form.designer.locales.doc/i_xfdl_r_formats_fi_FI.html Hard to imagine it's a bug in Mac OS though.
Or, another Google search shows that IBM had a bug like this: http://www-01.ibm.com/support/docview.wss?uid=swg1OA22258
Anyhow, are there any Mac developers who know Finnish, who understand this issue, and what might be going on?
OK, I reported this as a bug to apple, and I got back a pretty helpful reply, so I thought I would share it here.
Engineering has determined that this is an issue for you to resolve based on the following:
You should never be setting the format "MMMM yyyy" directly in NSDateFormatter if you want to work in various languages; some may have the year first, etc.
If you want a format that uses full month name MMMM + year, you should pass that as a "template" to NSDateFormatter dateFormatFromTemplate: like so: NSString* format = [NSDateFormatter dateFormatFromTemplate:@"yMMMM" options:0 locale: locale];
For a Finnish locale, this results in the date format "LLLL y" which will produce the proper nominative form of the month names: tammikuu, helmikuu, maaliskuu, etc.
Many languages including Finnish and many Slavic languages use a nominative form of the month name without a day number, and a genitive form or some related form (partitive for Finnish) for month name with day number. NSDateFormatter has both, with MMMM referring to the genitive form and LLLL referring to the nominative form. [NSDateFormatter dateFormatFromTemplate ...] can determine which one to use based on what fields are in the template. So you provide a template specifying either MMMM or LLLL and it will be mapped to the correct form in the resulting format.
Note that in such templates, space and punctuation are ignored; they will be determined as part of the data on correct date formats for the specifed locale.
For more information on pattern character such as MMM and LLL, see http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
For information on dateFormatFromTemplate, see https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html#//apple_ref/occ/clm/NSDateFormatter/dateFormatFromTemplate:options:locale:
The problem here is something the developer needs to address in their usage of NSDateFormatter; NSDateFormatter is behaving as intended.
Just noticed, I left out an important part: After getting the format string by passing a template to [NSDateFormatter dateFormatFromTemplate...] then that format string is the one that should be set in [NSDateFormatter setDateFormat:...] (perhaps that is obvious but it is worth saying)