Skip to content

Commit

Permalink
Fix translation
Browse files Browse the repository at this point in the history
  • Loading branch information
lexqt committed Apr 9, 2012
1 parent 0cfb849 commit ac00d65
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 42 deletions.
10 changes: 10 additions & 0 deletions ganttcalendar/api.py
Expand Up @@ -28,6 +28,16 @@
12: N_('December'),
}

weekdays = (
N_('Monday'),
N_('Tuesday'),
N_('Wednesday'),
N_('Thursday'),
N_('Friday'),
N_('Saturday'),
N_('Sunday'),
)

date_format = '%Y-%m-%d' # ISO 8601

def add_months(year, month, months):
Expand Down
43 changes: 22 additions & 21 deletions ganttcalendar/templates/calendar.html
@@ -1,6 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:i18n="http://genshi.edgewall.org/i18n"
i18n:domain="ganttcalendar">
<xi:include href="layout.html" />
<head>
<title>Ticket calendar</title>
Expand All @@ -15,25 +17,25 @@
<body>
<form>
<fieldset id="options">
<legend class="foldable">${_('Options')}</legend>
<legend class="foldable">Options</legend>
<table class="list">
<tr>
<td>
</td>
<td>
<label>
${_('Milestone')}
Milestone
<select name="selected_milestone">
<option py:for="m in milestones" value="${m.name}" selected="${selected_milestone==m.name or None}">${m.name}</option>
</select>
</label>
<label>
<input type="checkbox" name="show_my_ticket" checked="${show_my_ticket or None}"
/>${_('Show only my tickets')}
/>Show only my tickets
</label>
<label>
<input type="checkbox" name="hide_closed_ticket" checked="${not show_closed_ticket or None}"
/>${_('Exclude closed tickets')}
/>Exclude closed tickets
</label>
</td>
<td align="right">
Expand All @@ -53,7 +55,7 @@
value="$y"
selected="${y==current.year or None}">$y</option>
</select>
${_('Year')}
Year
<select name="month" onchange="form.day.value = 1; form.weekly.value = 0;">
<option py:for="m in [1,2,3,4,5,6,7,8,9,10,11,12]"
value="$m" selected="${m==current.month or None}">${_(month_tbl[m])}</option>
Expand All @@ -79,16 +81,17 @@
</table>
</form>
<table py:if="sum_estimatedhours is not None" class="list">
<div style="font-size:11px;">&nbsp; ${_('Total Hours')}: ${round(sum_totalhours, 2)}h &nbsp;/&nbsp;
${_('Estimated Hours')}: ${round(sum_estimatedhours, 2)}h</div>
<div style="font-size:11px;" i18n:msg="total, estimated">
Total Hours: ${round(sum_totalhours, 2)}h /
Estimated Hours: ${round(sum_estimatedhours, 2)}h
</div>
</table>
<table class="list with-cells">
<thead>
<tr py:with="weekdays = [_('Monday'), _('Tuesday'), _('Wednesday'),
_('Thursday'), _('Friday'), _('Saturday'), _('Sunday')]">
<tr>
<th></th>
<py:for each="d in range(7)" py:with="mday= first+ timedelta(d);wk=mday.weekday();">
<th style="width: 14%;">${weekdays[wk]}</th>
<th style="width: 14%;">${_(weekdays[wk])}</th>
</py:for>
</tr>
</thead>
Expand All @@ -99,9 +102,7 @@
<py:for each="d in range(7)" py:with="mday= first+ timedelta(w*7+d);holiday_desc= days[mday].get('holiday_desc');">
<td class="${days[mday]['kind']}" style="width: 14%;" valign="top">
<div class="textright">
<span py:attrs="{'title':holiday_desc}" py:strip="holiday_desc==None" >
<py:if test="weekly or mday.day==1">${mday.month}/</py:if>${mday.day}
</span>
</div>
<py:for each="c in range(len(days[mday]['ticket']))">
<div class="ticket" py:with="t=tickets[days[mday]['ticket'][c]['num']]">
Expand All @@ -112,15 +113,15 @@
<br />
<s py:strip="t['status']!='closed'"> ${t['type']}#${t['id']}</s>: ${t['summary']}<br />
<br />
<strong>${_('Start date')}</strong>: <span py:if="t['due_assign'] is not None">${t['due_assign'].strftime(date_format)}</span>
<strong>Start date</strong>: <span py:if="t['due_assign'] is not None">${t['due_assign'].strftime(date_format)}</span>
<span py:if="t['status']!='closed'">(${t['status']} ${t['complete']}%)</span><br/>
<strong>${_('End date')}</strong>: <span py:if="t['due_close'] is not None">${t['due_close'].strftime(date_format)}</span>
<strong>End date</strong>: <span py:if="t['due_close'] is not None">${t['due_close'].strftime(date_format)}</span>
<span py:if="t['status']=='closed'">(${t['status']}: ${t['resolution']})</span><br/>
<strong>${_('Owner')}</strong>: ${format_author(t['owner'])}<br />
<strong>${_('Priority')}</strong>: ${t['priority']}<br/>
<py:if test="t['estimatedhours'] is not None">
<strong>${_('Total Hours')}</strong>: ${round(t['totalhours'], 2)}h &nbsp;/&nbsp;
<strong>${_('Estimated Hours')}</strong>: ${round(t['estimatedhours'], 2)}h<br/>
<strong>Owner</strong>: ${format_author(t['owner'])}<br />
<strong>Priority</strong>: ${t['priority']}<br/>
<py:if test="t['estimatedhours'] is not None" i18n:msg="totallabel, total, estimatedlabel, estimated">
<strong>Total Hours</strong>: ${round(t['totalhours'], 2)}h /
<strong>Estimated Hours</strong>: ${round(t['estimatedhours'], 2)}h<br/>
</py:if>
<pre> ${t['description']}</pre>
</span>
Expand All @@ -136,7 +137,7 @@
<br />
<img src="${href.chrome('ticketcalendar/img/package.png')}" />${m['name']}<br />
<br />
<strong>${_('Due')}</strong>: ${m['due'].strftime(date_format)}<br />
<strong>Due</strong>: ${m['due'].strftime(date_format)}<br />
<pre> ${m['description']}</pre>
</span>
</a>
Expand Down
39 changes: 20 additions & 19 deletions ganttcalendar/templates/gantt.html
@@ -1,6 +1,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:i18n="http://genshi.edgewall.org/i18n"
i18n:domain="ganttcalendar"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:with="
px_ti=30;
Expand Down Expand Up @@ -32,12 +33,12 @@
<body py:with="weekdays = [_('Mo'), _('Tu'), _('We'), _('Th'), _('Fr'), _('Sa'), _('Su')]">
<form id="query" method="get">
<fieldset id="options" style="font-size:100%">
<legend class="foldable">${_('Options')}</legend>
<legend class="foldable">Options</legend>
<table class="list">
<tr>
<td>
<label>
${_('Base Day')}
Base Day
<input type="text" id="field-baseday" name="baseday"
value="${baseday.strftime(date_format)}" length="10" style="font-size:100%"/>
</label>
Expand All @@ -47,10 +48,10 @@
<td>
<py:if test="components">
<label>
${_('Sort by')}
Sort by
<select name="sorted_field" style="font-size:100%">
<option value="milestone" selected="${sorted_field=='milestone' or None}">${_('Milestone')}</option>
<option value="component" selected="${sorted_field=='component' or None}">${_('Component')}</option>
<option value="milestone" selected="${sorted_field=='milestone' or None}">Milestone</option>
<option value="component" selected="${sorted_field=='component' or None}">Component</option>
</select>
</label>
</py:if>
Expand Down Expand Up @@ -81,11 +82,11 @@
</tr>
<tr>
<td>
<label><input type="checkbox" name="show_my_ticket" checked="${show_my_ticket or None}" />${_('Show only my tickets')}</label>
<label><input type="checkbox" name="hide_closed_ticket" checked="${not show_closed_ticket or None}" />${_('Exclude closed tickets')}</label>
<label><input type="checkbox" name="show_my_ticket" checked="${show_my_ticket or None}" />Show only my tickets</label>
<label><input type="checkbox" name="hide_closed_ticket" checked="${not show_closed_ticket or None}" />Exclude closed tickets</label>
&nbsp; &nbsp;
<label><input type="checkbox" name="show_ticket_summary" checked="${show_ticket_summary or None}" />${_('Show ticket summary')}</label>
<label><input type="checkbox" name="hide_ticket_status" checked="${not show_ticket_status or None}" />${_('Hide ticket status')}</label><br/>
<label><input type="checkbox" name="show_ticket_summary" checked="${show_ticket_summary or None}" />Show ticket summary</label>
<label><input type="checkbox" name="hide_ticket_status" checked="${not show_ticket_status or None}" />Hide ticket status</label><br/>

</td>
<td align="right" valign="bottom">
Expand All @@ -105,7 +106,7 @@
value="$y"
selected="${y==current.year or None}">$y</option>
</select>
${_('Year')}
Year
<select name="month">
<option py:for="m in [1,2,3,4,5,6,7,8,9,10,11,12]"
value="$m" selected="${m==current.month or None}">${_(month_tbl[m])}</option>
Expand All @@ -129,8 +130,8 @@
</tr>
</table>
</form>
<div py:if="sum_estimatedhours is not None" style="font-size:11px;">
&nbsp; ${_('Total Hours')}: ${round(sum_totalhours, 2)}h &nbsp;/&nbsp; ${_('Estimated Hours')}: ${round(sum_estimatedhours, 2)}h
<div py:if="sum_estimatedhours is not None" style="font-size:11px;" i18n:msg="total, estimated">
Total Hours: ${round(sum_totalhours, 2)}h / Estimated Hours: ${round(sum_estimatedhours, 2)}h
</div>
<!-- gantt -->
<div style="position:relative;left:1px;top:1px;width:100%;height:${maxtic*px_ti+px_hd+1+40+px_height}px;">
Expand Down Expand Up @@ -245,16 +246,16 @@
<br/>
<s py:strip="t['status']!='closed'"> ${t['type']} #${t['id']}</s>: ${t['summary']}<br/>
<br/>
<strong>${_('Start date')}</strong>:
<strong>Start date</strong>:
${t['due_assign'].strftime(date_format)}
<span py:if="t['status']!='closed'">(${t['status']} ${t['complete']}%)</span><br/>
<strong>${_('End date')}</strong>:
<strong>End date</strong>:
${t['due_close'].strftime(date_format)}
<span py:if="t['status']=='closed'">(${t['status']}: ${t['resolution']})</span><br/>
<strong>${_('Owner')}</strong>: ${format_author(t['owner'])}<br/>
<strong>${_('Priority')}</strong>: ${t['priority']}<br/>
<py:if test="t['estimatedhours'] is not None">
<strong>${_('Total Hours')}</strong>: ${round(t['totalhours'], 2)}h &nbsp;/&nbsp; <strong>${_('Estimated Hours')}</strong>: ${round(t['estimatedhours'], 2)}h<br/>
<strong>Owner</strong>: ${format_author(t['owner'])}<br/>
<strong>Priority</strong>: ${t['priority']}<br/>
<py:if test="t['estimatedhours'] is not None" i18n:msg="totallabel, total, estimatedlabel, estimated">
<strong>Total Hours</strong>: ${round(t['totalhours'], 2)}h / <strong>Estimated Hours</strong>: ${round(t['estimatedhours'], 2)}h<br/>
</py:if>
<pre> ${t['description']}</pre>
</span>
Expand All @@ -275,7 +276,7 @@
<br/>
<img src="${href.chrome('ganttchart/img/package.png')}" />${t['milestone']}<br/>
<br/>
<strong>${_('Due')}</strong>: <span py:if="m.due">${m.due.strftime(date_format)}</span><br/>
<strong>Due</strong>: <span py:if="m.due">${m.due.strftime(date_format)}</span><br/>
<pre> ${m.description}</pre>
</span>
</a>
Expand Down
4 changes: 2 additions & 2 deletions ganttcalendar/ticketcalendar.py
Expand Up @@ -14,7 +14,7 @@

from trac.project.api import ProjectManagement

from ganttcalendar.api import TracGanttCalendar, month_tbl, date_format, _
from ganttcalendar.api import TracGanttCalendar, month_tbl, weekdays, date_format, _


__all__ = ['TicketCalendar']
Expand Down Expand Up @@ -214,7 +214,7 @@ def process_request(self, req):
'tickets':tickets, 'milestones':milestones,'days':days,
'sum_estimatedhours':sum_estimatedhours, 'sum_totalhours':sum_totalhours,
'show_my_ticket': show_my_ticket, 'show_closed_ticket': show_closed_ticket, 'selected_milestone': selected_milestone,
'_':_,'date_format':date_format, 'month_tbl': month_tbl}
'_':_,'date_format':date_format, 'month_tbl': month_tbl, 'weekdays': weekdays}

add_stylesheet(req, 'ticketcalendar/css/calendar.css')

Expand Down

0 comments on commit ac00d65

Please sign in to comment.