#758: Part of message not displayed after translation
--------------------------+----------------------
 Reporter:  SaintGermain  |      Owner:  nobody
     Type:  defect        |     Status:  new
 Priority:  minor         |  Milestone:
Component:  dashboard     |    Version:  0.8.0dev
 Keywords:  i18n          |
--------------------------+----------------------
 Following translation scaffolding of ticket #694.

 In file
 bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html
 the usual translation scaffolding doesn't work.

 Before translation scaffolding:
 {{{#!python
 <py:def function="timeline_empty()">
   No events reported
   <py:if test="context.resource.id">
     for <em>${summary_of(context.resource)}</em>
   </py:if>
   in the last <em>$daysback</em> days since
   <span class="date">${format_date(fromdate)}</span>.
   This may happen if system is not configured correctly.
   Please contact your administrator if you think this is the case.
 </py:def>
 }}}

 After translation scaffolding:
 {{{#!python
 <py:def function="timeline_empty()">
   <i18n:msg params="resource,daysback,fromdate">
     No events reported
     <py:if test="context.resource.id">
       for <em>${summary_of(context.resource)}</em>
     </py:if>
     in the last <em>$daysback</em> days since
     <span class="date">${format_date(fromdate)}</span>.
     This may happen if system is not configured correctly.
     Please contact your administrator if you think this is the case.
   </i18n:msg>
 </py:def>
 }}}

 Instead of the following message after translation:
 {{{
 No events reported for $resource in the last $daysback days since $date.
 This may happen if system is not configured correctly. Please contact your
 administrator if you think this is the case.
 }}}

 We got the truncated:
 {{{
 No events reported for
 }}}

 I managed to reproduce the bug with a simple test case.
 Create the following files test.py and bug.html in the same directory and
 execute test.py

 test.py:
 {{{#!python
 from genshi.template import TemplateLoader, MarkupTemplate
 from genshi.filters import Translator
 from trac.util import translation

 loader = TemplateLoader('.', callback=lambda template:
 Translator(translation.get_translations()).setup(template))
 template = loader.load('bug.html')
 print(template.generate())
 }}}

 bug.html:
 {{{
 <html xmlns="http://www.w3.org/1999/xhtml";
       xmlns:py="http://genshi.edgewall.org/";
       xmlns:i18n="http://genshi.edgewall.org/i18n";>
   <p>
      <i18n:msg params="resource,daysback,fromdate">
       No events reported
       <py:if test="1">
         for <em>resource</em>
       </py:if>
       in the last <em>daysback</em> days since
       <span class="date">fromdate</span>.
       This may happen if system is not configured correctly.
       Please contact your administrator if you think this is the case.
       </i18n:msg>
   </p>
 </html>
 }}}

 result:
 {{{
 <html xmlns="http://www.w3.org/1999/xhtml";>
   <p>
      No events reported
         for
   </p>
 }}}

 The problem is probably in Genshi, Babel or Trac.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/758>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Reply via email to