#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
+# include <locale.h>
+#endif
+
+
+static void locale_date(char *str, size_t str_len, int year, int month, int day);
/*
* some extern variables
abook_list_free(&emails);
} else if(cur->field->type == FIELD_DATE) {
int day, month, year;
- char buf[12];
+ char buf[64];
+ /* put raw representation of date in buf */
find_field_number(cur->field->key, &nb);
if((str = db_fget_byid(item, nb)) != NULL)
strncpy(buf, str, sizeof(buf));
if(str && parse_date_string(buf, &day, &month, &year)) {
- if(year)
- str = strdup_printf("%04d-%02d-%02d",
- year, month, day);
- else
- str = strdup_printf("--%02d-%02d",
- month, day);
- mvwaddnstr(editw, y, TAB_COLON_POS + 2, str,
- bytes2width(str, FIELD_MAX_WIDTH));
- free(str);
+ /* put locale representation of date in buf */
+ locale_date(buf, sizeof(buf), year, month, day);
+ mvwaddnstr(editw, y, TAB_COLON_POS + 2, buf,
+ bytes2width(buf, FIELD_MAX_WIDTH));
}
} else {
find_field_number(cur->field->key, &nb);
abook_list_free(&list);
}
+/*
+ * str is a buffer of max length str_len, which, after calling, will
+ * contain a representation of the given [y, m, d] date using the
+ * current locale (as defined by LC_TIME).
+ *
+ * Default is an ISO 8601 representation.
+ *
+ * %-sequences available to translators: %y, %Y, %m, %M, %d, %D represent
+ * year, month, and day (the uppercase version telling to fill with leading
+ * zeros if necessary)
+ */
+static void
+locale_date(char *str, size_t str_len, int year, int month, int day)
+{
+ char *s = str, *fmt;
+ size_t len;
+
+#if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
+ fmt = year ? dcgettext(PACKAGE, "%Y-%M-%D", LC_TIME) :
+ dcgettext(PACKAGE, "--%M-%D", LC_TIME);
+#else
+ if(year)
+ snprintf(str, str_len, "%04d-%02d-%02d", year, month, day);
+ else
+ snprintf(str, str_len, "--%02d-%02d", month, day);
+ return;
+#endif
+
+ while(*fmt && (s - str + 1 < str_len)) {
+ if(*fmt != '%') {
+ *s++ = *fmt++;
+ continue;
+ }
+
+ len = str_len - (str - s);
+ switch(*++fmt) {
+ case 'y': s += snprintf(s, len, "%d", year); break;
+ case 'Y': s += snprintf(s, len, "%04d", year); break;
+ case 'm': s += snprintf(s, len, "%d", month); break;
+ case 'M': s += snprintf(s, len, "%02d", month); break;
+ case 'd': s += snprintf(s, len, "%d", day); break;
+ case 'D': s += snprintf(s, len, "%02d", day); break;
+ case '%': /* fall through */
+ default:
+ *s++ = '%';
+ *s++ = *fmt;
+ break;
+ }
+ fmt++;
+ }
+ *++s = 0;
+}
+
static int is_valid_date(const int day, const int month, const int year)
{
int valid = 1;
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: <abook-devel@lists.sourceforge.net>\n"
-"POT-Creation-Date: 2006-08-31 08:12+0300\n"
+"POT-Creation-Date: 2006-09-07 23:31+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "Press enter to continue...\n"
msgstr ""
-#: abook.c:141
+#: abook.c:143
#, c-format
msgid "File %s is not writeable"
msgstr ""
-#: abook.c:146
+#: abook.c:148
msgid "If you continue all changes will be lost. Do you want to continue?"
msgstr ""
-#: abook.c:165
+#: abook.c:167
msgid "Save database"
msgstr ""
-#: abook.c:167
+#: abook.c:169
msgid "Quit without saving"
msgstr ""
-#: abook.c:223
+#: abook.c:227
#, c-format
msgid "%s is not a valid HOME directory\n"
msgstr ""
-#: abook.c:254
+#: abook.c:258
#, c-format
msgid ""
"Cannot combine options --mutt-query, --convert, --add-email or --add-email-"
"quiet\n"
msgstr ""
-#: abook.c:285
+#: abook.c:289
#, c-format
msgid "please use option --%s after --convert option\n"
msgstr ""
-#: abook.c:384
+#: abook.c:388
#, c-format
msgid "%s: unrecognized arguments on command line\n"
msgstr ""
-#: abook.c:406
+#: abook.c:410
msgid " -h\t--help\t\t\t\tshow usage"
msgstr ""
-#: abook.c:407
+#: abook.c:411
msgid " -C\t--config\t<file>\t\tuse an alternative configuration file"
msgstr ""
-#: abook.c:408
+#: abook.c:412
msgid "\t--datafile\t<file>\t\tuse an alternative addressbook file"
msgstr ""
-#: abook.c:409
+#: abook.c:413
msgid "\t--mutt-query\t<string>\tmake a query for mutt"
msgstr ""
-#: abook.c:410
+#: abook.c:414
msgid ""
"\t--add-email\t\t\tread an e-mail message from stdin and\n"
"\t\t\t\t\tadd the sender to the addressbook"
msgstr ""
-#: abook.c:414
+#: abook.c:418
msgid ""
"\t--add-email-quiet\t\tsame as --add-email but doesn't\n"
"\t\t\t\t\trequire to confirm adding"
msgstr ""
-#: abook.c:418
+#: abook.c:422
msgid "\t--convert\t\t\tconvert address book files"
msgstr ""
-#: abook.c:419
+#: abook.c:423
msgid "\toptions to use with --convert:"
msgstr ""
-#: abook.c:420
+#: abook.c:424
msgid "\t--informat\t<format>\tformat for input file"
msgstr ""
-#: abook.c:421
+#: abook.c:425
msgid "\t\t\t\t\t(default: abook)"
msgstr ""
-#: abook.c:422
+#: abook.c:426
msgid "\t--infile\t<file>\t\tsource file"
msgstr ""
-#: abook.c:423
+#: abook.c:427
msgid "\t\t\t\t\t(default: stdin)"
msgstr ""
-#: abook.c:424
+#: abook.c:428
msgid "\t--outformat\t<format>\tformat for output file"
msgstr ""
-#: abook.c:425
+#: abook.c:429
msgid "\t\t\t\t\t(default: text)"
msgstr ""
-#: abook.c:426
+#: abook.c:430
msgid "\t--outfile\t<file>\t\tdestination file"
msgstr ""
-#: abook.c:427
+#: abook.c:431
msgid "\t\t\t\t\t(default: stdout)"
msgstr ""
-#: abook.c:428
+#: abook.c:432
msgid "\t--formats\t\t\tlist available formats"
msgstr ""
-#: abook.c:499
+#: abook.c:503
#, c-format
msgid "Cannot open database\n"
msgstr ""
-#: abook.c:625
+#: abook.c:629
#, c-format
msgid "too few arguments to make conversion\n"
msgstr ""
-#: abook.c:626
+#: abook.c:630
#, c-format
msgid "try --help\n"
msgstr ""
-#: abook.c:631
+#: abook.c:635
#, c-format
msgid ""
"input and output formats are the same\n"
"exiting...\n"
msgstr ""
-#: abook.c:645
+#: abook.c:649
#, c-format
msgid "input format %s not supported\n"
msgstr ""
-#: abook.c:649
+#: abook.c:653
#, c-format
msgid "cannot read file %s\n"
msgstr ""
-#: abook.c:658
+#: abook.c:662
#, c-format
msgid "output format %s not supported\n"
msgstr ""
-#: abook.c:664
+#: abook.c:668
#, c-format
msgid "cannot write file %s\n"
msgstr ""
-#: abook.c:685
+#: abook.c:689
#, c-format
msgid "cannot open %s\n"
msgstr ""
-#: abook.c:688
+#: abook.c:692
#, c-format
msgid "%d item(s) added to %s\n"
msgstr ""
-#: abook.c:690
+#: abook.c:694
msgid "Valid sender address not found"
msgstr ""
-#: abook.c:730
+#: abook.c:734
#, c-format
msgid "Address %s already in addressbook\n"
msgstr ""
-#: abook.c:740
+#: abook.c:744
#, c-format
msgid ""
"cannot open /dev/tty\n"
"you may want to use --add-email-quiet\n"
msgstr ""
-#: abook.c:746
+#: abook.c:750
#, c-format
msgid "Add \"%s <%s>\" to %s? (%c/%c)\n"
msgstr ""
-#: abook.c:750 abook.c:757 ui.c:343 ui.c:605
+#: abook.c:754 abook.c:761 ui.c:343 ui.c:609
msgid "keybinding for yes|y"
msgstr ""
-#: abook.c:751 abook.c:753 ui.c:341
+#: abook.c:755 abook.c:757 ui.c:341
msgid "keybinding for no|n"
msgstr ""
-#: abook.c:778
+#: abook.c:782
#, c-format
msgid "stdin is a directory or cannot stat stdin\n"
msgstr ""
msgid "Anniversary day"
msgstr ""
-#: database.c:164
+#: database.c:166
msgid "field already defined"
msgstr ""
-#: database.c:168
+#: database.c:170
msgid "standard field does not need to be declared"
msgstr ""
-#: database.c:183
+#: database.c:185
msgid "unknown type"
msgstr ""
-#: database.c:583
+#: database.c:585
msgid "Invalid field value defined in configuration"
msgstr ""
-#: database.c:586
+#: database.c:588
msgid "Invalid field value for sorting"
msgstr ""
-#: edit.c:53
+#: edit.c:57
msgid "Tab name too wide for screen"
msgstr ""
msgid "Item: "
msgstr ""
-#: edit.c:478
+#: edit.c:420
+msgid "%Y-%M-%D"
+msgstr ""
+
+#: edit.c:421
+msgid "--%M-%D"
+msgstr ""
+
+#: edit.c:520
msgid "Day: "
msgstr ""
-#: edit.c:478
+#: edit.c:520
msgid "Month: "
msgstr ""
-#: edit.c:478
+#: edit.c:520
msgid "Year (optional): "
msgstr ""
-#: edit.c:511
+#: edit.c:553
msgid "Invalid date"
msgstr ""
-#: edit.c:666
+#: edit.c:708
msgid "Name: "
msgstr ""
-#: edit.h:13
+#: edit.h:14
msgid "?:help q:quit editor"
msgstr ""
-#: filter.c:70 filter.c:81
+#: filter.c:71 filter.c:82
msgid "abook native format"
msgstr ""
-#: filter.c:71
+#: filter.c:72
msgid "ldif / Netscape addressbook"
msgstr ""
-#: filter.c:72 filter.c:83
+#: filter.c:73 filter.c:84
msgid "mutt alias"
msgstr ""
-#: filter.c:73 filter.c:85
+#: filter.c:74 filter.c:86
msgid "pine addressbook"
msgstr ""
-#: filter.c:74 filter.c:87
+#: filter.c:75 filter.c:88
msgid "comma separated values"
msgstr ""
-#: filter.c:75 filter.c:88
+#: filter.c:76 filter.c:89
msgid "comma separated values (all fields)"
msgstr ""
-#: filter.c:76 filter.c:89
+#: filter.c:77 filter.c:90
msgid "Palm comma separated values"
msgstr ""
-#: filter.c:82
+#: filter.c:83
msgid "ldif / Netscape addressbook (.4ld)"
msgstr ""
-#: filter.c:84
+#: filter.c:85
msgid "html document"
msgstr ""
-#: filter.c:86
+#: filter.c:87
msgid "GnomeCard (VCard) addressbook"
msgstr ""
-#: filter.c:90
+#: filter.c:91
msgid "elm alias"
msgstr ""
-#: filter.c:91
+#: filter.c:92
msgid "plain text"
msgstr ""
-#: filter.c:92
+#: filter.c:93
msgid "Wanderlust address book"
msgstr ""
-#: filter.c:93
+#: filter.c:94
msgid "Spruce address book"
msgstr ""
-#: filter.c:106
+#: filter.c:95
+msgid "BSD calendar"
+msgstr ""
+
+#: filter.c:108
msgid "input:"
msgstr ""
-#: filter.c:113
+#: filter.c:115
msgid "output:"
msgstr ""
-#: filter.c:178
+#: filter.c:180
msgid "import database"
msgstr ""
-#: filter.c:180 filter.c:297
+#: filter.c:182 filter.c:299
msgid "please select a filter"
msgstr ""
-#: filter.c:188 filter.c:305
+#: filter.c:190 filter.c:307
msgid "x -\tcancel"
msgstr ""
-#: filter.c:209 filter.c:343
+#: filter.c:211 filter.c:345
msgid "Filename: "
msgstr ""
-#: filter.c:216
+#: filter.c:218
msgid "Error occured while opening the file"
msgstr ""
-#: filter.c:218
+#: filter.c:220
msgid "File does not seem to be a valid addressbook"
msgstr ""
-#: filter.c:295
+#: filter.c:297
msgid "export database"
msgstr ""
-#: filter.c:328
+#: filter.c:330
msgid "Export <a>ll, export <s>elected, or <c>ancel?"
msgstr ""
-#: filter.c:329 ui.c:628
+#: filter.c:331 ui.c:632
msgid "keybindings:all/selected/cancel|asc"
msgstr ""
-#: filter.c:350
+#: filter.c:352
msgid "Error occured while exporting"
msgstr ""
+#: filter.c:1896
+#, c-format
+msgid "%02d/%02d\tAnniversary of %s\n"
+msgstr ""
+
#: help.h:11
msgid "\t?\t\thelp\n"
msgstr ""
msgid "\tv\t\t\tview url with web browser\n"
msgstr ""
-#: options.c:254
+#: options.c:250
msgid "quote mismatch"
msgstr ""
-#: options.c:260
+#: options.c:256
msgid "no assignment character found"
msgstr ""
-#: options.c:263
+#: options.c:259
msgid "error in comma separated list"
msgstr ""
-#: options.c:292 options.c:311
+#: options.c:289 options.c:308
msgid "invalid value"
msgstr ""
msgid "Clear WHOLE database"
msgstr ""
-#: ui.c:578
+#: ui.c:582
msgid "Search hit bottom, continuing at top"
msgstr ""
-#: ui.c:603
+#: ui.c:607
#, c-format
msgid "Your current data will be lost - Press '%c' to continue"
msgstr ""
-#: ui.c:628
+#: ui.c:632
msgid "Print <a>ll, print <s>elected, or <c>ancel?"
msgstr ""
-#: ui.c:634
+#: ui.c:638
msgid "No selected items"
msgstr ""
-#: ui.c:660
+#: ui.c:664
msgid "File to open: "
msgstr ""
-#: ui.c:670
+#: ui.c:674
msgid "Save current database"
msgstr ""
-#: ui.c:678
+#: ui.c:682
msgid "Sorry, the specified file appears not to be a valid abook addressbook"
msgstr ""