On Fri, Feb 5, 2010 at 1:52 AM, Christian Boos <[email protected]> wrote: > On 2/3/2010 7:48 AM, Richard Liao wrote: >> >> Thank you, Christian. >> >> Adding i18n:domain in templates can translate most messages now, >> > > Great! Would you pointing me to the actual code so that I could use that to > help me document the plugin translation process? > I have make an update here. http://trac-hacks.org/wiki/TracTicketTemplatePlugin
As to http://trac.edgewall.org/ticket/6353 (Translation Interfaces for javascript) is set to 0.12.1, I think javascript i18n support is not implemented in Trac trunk by now. TracTicketTemplatePlugin use a very rough home-made approach without #6353, which render javascript files as plain text template. In this way, i18n javascript file are in templates, instead of in htdocs :-) And it adds some other redundant codes, such as the fake _ function and messages list just for extracting messages. function _(message){ return message; } messages = [ _('My Template'), _('') ] >> except for strings like ${_("message")}. >> > > >> I have to do some dirty thing to make it work: >> >> <body i18n:domain="mydomain"> >> <?python >> from trac.util.translation import dgettext >> def _(string, **kwargs): return dgettext('mydomain', string, **kwargs) >> ?> >> <form action="." method="post"> >> <input type="submit" name="load" value="${_('Load')}" /> >> </form> >> </body> >> >> Is there a clean way for this? >> > > > In the python code of your plugin, you bind the "_" function using something > like: > http://trac.edgewall.org/browser/plugins/0.12/mercurial-plugin/tracext/hg/backend.py#L33 > right? > > You should simply pass that into the data dictionary which will be used by > the template. > > -- Christian > > -- > You received this message because you are subscribed to the Google Groups > "Trac Development" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/trac-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.
