We have customized our Trac instance to display additional content to the newticket page, with the following site.html
file (as explained in documentation):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
py:strip="">
<form py:match="div[@id='content' and @class='ticket']/form[@action='/newticket#ticket']" py:attrs="select('@*')">
<div class="warning">
<p>You are about to create a new JOSM ticket.
</p>
<p>Please make sure to always use this link in <a href="wiki/Help/Action/About">About Dialog</a> (Shift-F1) to come here:</p>
<img src="raw-attachment/wiki/Help/Action/About/bugreport_small.png" alt="Bug report link in About dialog" height="53" width="361" />
<p>Clicking on this link prefills the bug report with useful information for us (<a href="wiki/Help/Action/ShowStatusReport">Status Report</a>).
</p>
<p>In any case, don't be shy :) Please let us a way to contact you if needed (either by <a href="register">creating an account</a> or entering your e-mail address below (it won't be publicly visible but will allow us to reach you, and you will be notified about ticket progress).
</p>
</div>
${select('*')}
</form>
</html>
I don't see anything in the documentation about translation. How can we translate this text now?
I have finally come up with a small JavaScript solution.
It's simple when you only need a few languages with a text that doesn't change:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
py:strip="">
<form py:match="div[@id='content' and @class='ticket']/form[@action='/newticket#ticket']" py:attrs="select('@*')">
<div class="warning">
<table style="border:0; border-collapse:separate; border-spacing:0 10px" class="wiki">
<tr><td style="background:#FFFC75; border:1px solid #ccc; border-right:0" valign="top">
<p id="josm_warning_01">You are about to create a new JOSM ticket.
</p>
<p id="josm_warning_02">Please make sure to always use <a href="wiki/Help/Action/ReportBug">Help/Report bug</a> or this link in <a href="wiki/Help/Action/About">About Dialog</a> (Shift-F1) to come here:</p>
<img src="raw-attachment/wiki/Help/Action/ReportBug/reportbug.png" alt="Bug report menu entry" height="84" width="207" />
<img src="raw-attachment/wiki/Help/Action/About/bugreport_small.png" alt="Bug report link in About dialog" height="53" width="361" />
</td></tr>
</table>
</div>
<script type="text/javascript">
if (navigator.language.indexOf('fr') == 0) {
document.getElementById("josm_warning_01").innerHTML = 'Vous êtes sur le point de créer un nouveau ticket JOSM.';
document.getElementById("josm_warning_02").innerHTML = 'S\'il vous plaît, assurez-vous de toujours utiliser <a href="wiki/Help/Action/ReportBug">Aide/Rapporter un bug</a> ou ce lien dans la <a href="wiki/Help/Action/About">fenêtre À propos</a> (Shift-F1) pour venir ici:';
} else if (navigator.language.indexOf('de') == 0) {
document.getElementById("josm_warning_01").innerHTML = 'Sie sind dabei, ein neues JOSM-Ticket zu erstellen.';
document.getElementById("josm_warning_02").innerHTML = 'Bitte nutzen Sie immer <a href="wiki/De:Help/Action/ReportBug">Hilfe → Fehler melden</a> oder diesen Link im <a href="wiki/De:Help/Action/About">"Über JOSM..."-Fenster</a>, um hierher zu gelangen:';
}
</script>
${select('*')}
</form>
</html>