Date picker is now localized to the currently selected
authorArt Cancro <ajc@citadel.org>
Mon, 29 Sep 2008 16:44:10 +0000 (16:44 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 29 Sep 2008 16:44:10 +0000 (16:44 +0000)
language.  I'd appreciate it if some of you in the community of
international Citadel developers could test this a bit.

webcit/calendar_tools.c
webcit/fmt_date.c
webcit/gettext.c
webcit/static/wclib.js
webcit/webcit.h

index 23dd53524b8f435ce131a47aa96b29202c2f671f..1a9f9c99a080fdd841f2b432fb8fbb6b89bb5d44 100644 (file)
@@ -71,7 +71,7 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix) {
        wprintf("<script type=\"text/javascript\">");
        wprintf("attachDatePicker('");
        wprintf(prefix);
-       wprintf("');\n");
+       wprintf("', '%s');\n", get_selected_language());
        wprintf("</script>");
        wprintf(_("Hour: "));
        wprintf("<SELECT NAME=\"%s_hour\" SIZE=\"1\">\n", prefix);
index 7ae90fbb301b688fa1db3119a4387e066764a2f1..c541b7b17ec9f029d93514d00e56d6b65df03355 100644 (file)
@@ -39,6 +39,7 @@ size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm)
 }
 
 
+
 /*
  * Format a date/time stamp for output 
  */
index de380d6c84e1f951f870a942ea92b62d9c8c1c1c..352b6f7cb5f93a9eeb4d8486793932d8453258c0 100644 (file)
@@ -370,3 +370,22 @@ void TmplGettext(StrBuf *Target, int nTokens, WCTemplateToken *Token)
        StrBufAppendBufPlain(Target, _(Token->Params[0]->Start), -1, 0);
 
 }
+
+
+/*
+ * Returns the language currently in use.
+ * This function returns a static string, so don't do anything stupid please.
+ */
+const char *get_selected_language(void) {
+#ifdef ENABLE_NLS
+#ifdef HAVE_USELOCALE
+       return AvailLang[WC->selected_language];
+#else
+       return "en"
+#endif
+#else
+       return "en"
+#endif
+}
+
+
index d930c64ea126230a5d50ba82a7294ee43076cc06..2ba65152d6c1f86a86c4f36b4badec11711cb7b8 100644 (file)
@@ -960,12 +960,14 @@ function TaskViewGatherCategoriesFromTable() {
        var table = $('taskview');
        
 }
-function attachDatePicker(relative) {
+function attachDatePicker(relative, wclang) {
        var dpck = new DatePicker({
        relative: relative,
-       language: 'en', // fix please
+       language: wclang.substr(0,2),
        disableFutureDate: false,
        dateFormat: [ ["yyyy", "mm", "dd"], "-"],
+       showDuration: 0.2,
+       closeEffectDuration: 0.2,
        });
        document.getElementById(relative).dpck = dpck; // attach a ref to it
 }
index 9c1a0583bbea768c25684c0618d3a94e6f6b5612..06a2e66b2f8a7b63be52c944707e33752edd2e62 100644 (file)
@@ -824,6 +824,7 @@ void end_tab(int tabnum, int num_tabs);
 void str_wiki_index(char *s);
 int get_time_format_cached (void);
 int xtoi(const char *in, size_t len);
+const char *get_selected_language(void);
 void webcit_fmt_date(char *buf, time_t thetime, int brief);
 int fetch_http(char *url, char *target_buf, int maxbytes);