TTTTimeIntervalFormatter always returns strings in English

140 Views Asked by At

I am using TTTTimeIntervalFormatter to present user with relative time strings (such as '3 weeks ago'). The application is also used by German speakers, so I have made a German localisation. However, no matter what, the relative string is always presented in English to the user. Below is the code used to produce the string:

TTTTimeIntervalFormatter *timeFormatter = [[TTTTimeIntervalFormatter alloc] init];
long double postDateInSeconds = [[_postItem.caption objectForKey:@"created_time"] doubleValue] / 1000;
NSDate *postDate = [NSDate dateWithTimeIntervalSince1970:postDateInSeconds];
NSDate *now = [[NSDate alloc]init];

[timeFormatter setLocale:[NSLocale currentLocale]];
self.dateLabel.text = [timeFormatter stringForTimeIntervalFromDate:now toDate:postDate];

[timeFormatter setLocale:[NSLocale currentLocale]] should be telling the formatter that the locate is German, but even though all strings within the app are correctly displayed in German, TTTTimeFormatter refuses to display anything but English.

Any pointers on how to solver this localisation problem will be highly appreciated.

0

There are 0 best solutions below