Comment 6 for bug 652976

Revision history for this message
Marcel Stimberg (marcelstimberg) wrote :

@mterry: Your test program seems to give the correct result, but -- what will you do with the 24/12hr information in the end? There is "%R" for a locale-dependent 24h format without seconds but no equivalent for 12h that I'm aware of. Simply using "%I:%M %p" for 12hr locales would not make everyone happy.

I think using translations might actually work if you use a little hack, something along the lines of:
char *message_locale = setlocale(LC_MESSAGES, NULL);
char *time_locale = setlocale(LC_TIME, NULL);
setlocale(LC_MESSAGES, time_locale);
char *time_format = _("%I:%M %p"); /* This will be translated using the PO file corresponding to LC_TIME!*/
setlocale(LC_MESSAGES, message_locale);