On Tue, 19 Nov 2013 12:13:51 -0800, Ryan Ollos
<[email protected]> wrote :

> On Tue, Nov 19, 2013 at 5:16 AM, Saint Germain <[email protected]>
> wrote:
> 
> > I have updated my repo on bitbucket to correct the patch for ticket
> > #694 and finished the french translation on Transifex.
> >
> > I will create a separate branch/patch on Bitbucket which includes
> > the french translation and make a pull request.
> >
> > Here are a few comments but mostly it works ! ;-)
> >
> > 1) There a lot (around 300-400 I think) of duplicated strings with
> > Trac. With Transifex I just quickly copy-pasted the translation, but
> > ideally (Don't Repeat Yourself) we should mark these strings as
> > duplicates of Trac strings (big work)
> >
> > 2) So far I see 2 parts where the translation doesn't work:
> >   a) the test in the Seach box ("Search all produts. Try
> > TracLinks"). I have no idea why it doesn't work
> >   b) In the Custom Query page, the checkboxes "accepted, assigned,
> > closed, needinfo, etc." are still in english (I don't know where the
> > names are defined)
> >
> > 3) In case of problem in the translation process, the stack trace is
> > very difficult to understand. For example I had a problem with a new
> > version of Babel and the result was something like
> > "NullTranslationsBabel has no attribute isactive". I will propose
> > some more try/request on trac/trac/util/translation.py in order to
> > have a more useful debug log
> >
> 
> Regarding (2a),
> 
> The Genshi documentation says "The default is to consider the
> attributes abbr, alt, label, prompt, standby, summary, and title,
> which is a list that makes sense for HTML documents. Of course, you
> can tell the translator to use a different set of attribute names, or
> none at all."
> http://genshi.edgewall.org/wiki/Documentation/i18n.html#id3
> 
> It looks like the set of attributes is specified when instantiating
> the Translator object:
> http://genshi.edgewall.org/browser/tags/0.6.0/genshi/filters/i18n.py?marks=609-611,614-615#L596
> 
> Since "placeholder" is a new HTML5 attribute, it probably hasn't been
> considered in a release of Genshi. The latest Genshi release is 0.7,
> and it is not included in the set yet.
> http://genshi.edgewall.org/browser/tags/0.7.0/genshi/filters/i18n.py?marks=606-608#L596
> 
> It seems like we have 2 options:
>  1. Specify include_attrs when constructing the Translator object in
> trac.web.chrome:
> http://trac.edgewall.org/browser/branches/1.0-stable/trac/web/chrome.py?rev=12211&marks=951#L938
>  2. Ask the Genshi team to include "placeholder" in the set.
> 
> There doesn't seem to be much development activity with Genshi
> lately, so (1) would probably be the faster solution. We could patch
> our copy of Trac and open a ticket with Trac for pushing the change
> to the core. We should consider whether there are any other HTML5
> attributes we are utilizing or might utilize in the future that
> should be included in the translatable set. We might even just expose
> an INCLUDE_ATTRS variable in trac.web.chrome that a theme could set.
> 
> Would you kindly test whether specifying `incl_attributes` in
> trac.web.chrome:load_template makes the string translatable?
> 

With the following patch:
diff -r 15e5b368262d trac/trac/web/chrome.py
--- a/trac/trac/web/chrome.py   Tue Nov 19 03:23:37 2013 +0100
+++ b/trac/trac/web/chrome.py   Tue Nov 19 21:46:07 2013 +0100
@@ -938,7 +938,7 @@
                 max_cache_size=self.genshi_cache_size,
                 default_encoding="utf-8",
                 variable_lookup='lenient', callback=lambda template:
-                Translator(translation.get_translations()).setup(template))
+                
Translator(translation.get_translations(),include_attrs=('placeholder')).setup(template))
 
         if method == 'text':
             cls = NewTextTemplate

It works !
Thanks for having taken the time for this _very_ detailed explanation.

> Regarding (2b)
> 
> I believe it is the case that the workflow states aren't translated,
> and there is an open ticket for this:
> http://trac.edgewall.org/ticket/9472

Ok, it may be a bit difficult for my proficiency level of Trac but I'll see if 
I can do something.

Thanks again !

Reply via email to