diff --git a/po/nl.po b/po/nl.po index fb9053004..7152a6d94 100644 --- a/po/nl.po +++ b/po/nl.po @@ -10345,12 +10345,12 @@ msgstr "Stiefbroers en stiefzussen" #: ../src/plugins/NarrativeWeb.py:2486 #, python-format msgid "%(date)s   at   %(place)s" -msgstr "%(date)s  te   %(place)s" +msgstr "%(date)s   te   %(place)s" #: ../src/plugins/NarrativeWeb.py:2488 #, python-format msgid "at   %(place)s" -msgstr "te    %(place)s" +msgstr "te   %(place)s" #: ../src/plugins/NarrativeWeb.py:2505 #, python-format @@ -11915,7 +11915,7 @@ msgid "" "Generated by GRAMPS on %(date)s" msgstr "" -"Gegenereerd met target=\"_blank" +"Gegenereerd met GRAMPS op %(date)s" #. Create progress bar for it @@ -12026,7 +12026,7 @@ msgstr "Opmerkingen jan" #: ../src/plugins/WebCal.py:1286 msgid "This prints in January" -msgstr "Dit wordt in januarie afgedrukt" +msgstr "Dit wordt in januari afgedrukt" #: ../src/plugins/WebCal.py:1287 msgid "The note for the month of January" @@ -12038,7 +12038,7 @@ msgstr "Opmerking feb" #: ../src/plugins/WebCal.py:1290 msgid "This prints in February" -msgstr "Dit wordt in februarie afgedrukt" +msgstr "Dit wordt in februari afgedrukt" #: ../src/plugins/WebCal.py:1291 msgid "The note for the month of February" @@ -12134,15 +12134,15 @@ msgstr "Een opmerking voor september" #: ../src/plugins/WebCal.py:1324 msgid "Oct Note" -msgstr "Opmerking oct" +msgstr "Opmerking okt" #: ../src/plugins/WebCal.py:1324 msgid "This prints in October" -msgstr "Dit wordt in october afgedrukt" +msgstr "Dit wordt in oktober afgedrukt" #: ../src/plugins/WebCal.py:1325 msgid "The note for the month of October" -msgstr "Een opmerking voor october" +msgstr "Een opmerking voor oktober" #: ../src/plugins/WebCal.py:1328 msgid "Nov Note" diff --git a/src/plugins/WebCal.py b/src/plugins/WebCal.py index 391d43285..d4157aa22 100644 --- a/src/plugins/WebCal.py +++ b/src/plugins/WebCal.py @@ -231,6 +231,15 @@ class WebCalReport(Report): self.warn_dir = True # Only give warning once. + # Set first weekday according to Locale + xmllang = Utils.xml_lang() + if xmllang == "en-US": + # USA calendar starts on a Sunday + calendar.setfirstweekday(calendar.SUNDAY) + else: + # European calendar starts on Monday, default + calendar.setfirstweekday(calendar.MONDAY) + def copy_file(self, from_fname, to_fname, to_dir=''): """ Copy a file from a source to a (report) destination. @@ -280,6 +289,9 @@ class WebCalReport(Report): return (start, stop) def add_day_item(self, text, year, month, day): + if day == 0: + # This may happen for certain "about" dates. + day = 1 # Use first day of the month month_dict = self.calendar.get(month, {}) day_list = month_dict.get(day, []) day_list.append(text) @@ -358,9 +370,13 @@ class WebCalReport(Report): self.copy_file(from_file, "arrow102.gif", "images") def display_nav_links(self, of, currentsection, cal): + """ + 'cal' - one of "yg", "by", "wc", "ip" + """ # Check to see if home_link will be used??? navs = [ + (self.home_link,_('Home'), self.home_link), ('January', _('Jan'), True), ('February', _('Feb'), True), ('March', _('Mar'), True), @@ -388,16 +404,17 @@ class WebCalReport(Report): url += self.ext # Figure out if we need
  • or just plain
  • - cs = False + cs = '' if nav_text == currentsection: - cs = True + cs = ' id="CurrentSection"' - cs = cs and ' id="CurrentSection"' or '' of.write(' %s
  • \n' % (cs, url, nav_text)) def calendar_build(self, of, cal, month): """ This does the work of building the calendar + 'cal' - one of "yg", "by", "wc" + 'month' - month number 1, 2, .., 12 """ year = self.year @@ -412,6 +429,9 @@ class WebCalReport(Report): of.write('%s\n' % title) of.write(' \n') + # This calendar has first column sunday. Do not use locale! + calendar.setfirstweekday(calendar.SUNDAY) + # Calendar weekday names header of.write(' \n') of.write(' ') @@ -437,12 +457,16 @@ class WebCalReport(Report): of.write(' \n') of.write(' \n') - monthinfo = calendar.monthcalendar(year, month) - nweeks = len(monthinfo) + + # Compute the first day to display for this month. + # It can also be a day in the previous month. current_date = datetime.date(year, month, 1) # first day of the month + # isoweekday: 1=monday, 2=tuesday, etc if current_date.isoweekday() != 7: # start dow here is 7, sunday + # Compute the sunday before this date. current_ord = current_date.toordinal() - current_date.isoweekday() else: + # First day of the month is sunday, that's OK current_ord = current_date.toordinal() # get last month's last week for previous days in the month @@ -451,19 +475,22 @@ class WebCalReport(Report): else: prevmonth = calendar.monthcalendar(year, month-1) num_weeks = len(prevmonth) - lastweek = prevmonth[num_weeks - 1] + lastweek_prevmonth = prevmonth[num_weeks - 1] # get next month's first week for next days in the month if month == 12: nextmonth = calendar.monthcalendar(year+1, 1) else: nextmonth = calendar.monthcalendar(year, month + 1) - nextweek = nextmonth[0] + firstweek_nextmonth = nextmonth[0] # Begin calendar + monthinfo = calendar.monthcalendar(year, month) + nweeks = len(monthinfo) for week_row in range(0, nweeks): week = monthinfo[week_row] of.write(' \n' % week_row) + for days_row in range(0, 7): if days_row == 0: dayclass = "weekend sunday" @@ -471,31 +498,33 @@ class WebCalReport(Report): dayclass = "weekend saturday" else: dayclass = "weekday" + day = week[days_row] - if day == 0: # previous or next month day - if week_row == 0: # previous day - specday = lastweek[days_row] + if day == 0: # a day in the previous or in the next month + if week_row == 0: # day in the previous month + specday = lastweek_prevmonth[days_row] specclass = "previous " + dayclass - elif week_row == nweeks-1: - specday = nextweek[days_row] + elif week_row == nweeks-1: # day in the next month + specday = firstweek_nextmonth[days_row] specclass = "next " + dayclass + of.write(' \n' % (specday, specclass)) of.write('
    %d
    \n' % specday) of.write(' \n') - else: # day number + + else: # normal day number in current month if cal == "by": - of.write(' \n' - % (day, dayclass)) + of.write(' \n' % (day, dayclass)) of.write('
    %d
    \n' % day) of.write(' \n') else: of.write(' []: + day_list = self.calendar.get(month, {}).get(thisday.day, []) + if day_list > []: specclass = "highlight " + dayclass of.write('class="%s">\n' % specclass) if cal == "yg": # Year at a Glance @@ -505,13 +534,12 @@ class WebCalReport(Report): % (lng_month, shrt_month, day, self.ext)) of.write('
    %d' '
    \n' % day) - self.indiv_date(month, day, list_) + self.indiv_date(month, day, day_list) else: # WebCal - of.write('
    %d' - '
    \n' % day) + of.write('
    %d
    \n' % day) of.write(' \n') else: of.write('class="%s">\n' % dayclass) - of.write('
    %d
    \n' - % day) + of.write('
    %d
    \n' % day) else: + # Either a day of previous month, or a day of next month of.write('class="%s">\n' % dayclass) of.write('
    %d
    \n' % day) of.write(' \n') + current_ord += 1 + of.write(' \n') # Complete six weeks for proper styling - self.six_weeks(of, nweeks) + # FIXME. Why would we need this? The for loop already + # creates all the weeks we need. At most six weeks. + # self.six_weeks(of, nweeks) def write_header(self, of, title, cal, mystyle): """ - This creates the header for the Calendars iincluding style embedded for special purpose + This creates the header for the Calendars including style embedded for special purpose """ of.write('\n') - return (of, author) + return author def write_footer(self, of, cal): """ @@ -635,9 +667,10 @@ class WebCalReport(Report): def close_file(self, of): of.close() - def indiv_date(self, month, day_num, list_): + def indiv_date(self, month, day_num, day_list): """ This method creates the indiv pages for "Year At A Glance" + 'dat_list' - lines of text to display at this day """ # TODO. Cleanup the "/" for URLs versus file names. @@ -655,7 +688,7 @@ class WebCalReport(Report): # Name the file, and create it cal_file = '%d/%s/%s%d%s' % (year, lng_month, shrt_month, day_num, self.ext) - ip = self.create_file(cal_file) + of = self.create_file(cal_file) mystyle = """