Hello Dirk,
First, let me CC: trac-dev, as the main issues are not with you misusing
the i18n, but rather about a few new undocumented features of 1.0.
On 9/25/2012 10:39 AM, Dirk St�cker wrote:
> Hello,
>
> I have another thing one of you can help me. I started I18N of
> spam-filter-plugin, but I can't find a proper place for the add_domain
> call. At least everything I tried failed till now.
>
> The SVN-code does not contain add_domain calls now. I tried in
> filtersystem.py and in admin.py, both failed.
Ok, add_domain is really needed, without it the messages will only be
fetched from the Trac catalog "messages.po" which contains none but a
few of the required translations (you may get by luck some of them, like
the one for "Author").
But as you found out, even when adding a proper call to add_domain, the
translations still won't show up...
>
> Can anyone of you two have a look and tell me whats wrong? I already did
> partial "de" translation, but can't get it working.
>
First problem: you try to translate the TracIni documentation.
Using _() for that is not OK, as this will try to get a translation at
module loading time, where no locale is yet set up. The strings should
be only marked for translations, using N_ (or better, cleandoc_, if you
add it to your setup.cfg as an extractor tag *and* you make sure that
the special trac.dist.extract_python extractor is used!). And finally,
the domain has to be specified for each option instance, using
doc_domain='tracspamfilter'.
Well, I realize the documentation for these new 1.0 features (#9666,
#10038) there should probably be a note in the L10N pages, like an
expanded version of the above together with an example in the
CookBook/PluginL10N.
Second problem: the Genshi templates. You were missing the
xmlns:i18n="
http://genshi.edgewall.org/i18n" namespace declaration,
but also the i18n-domain directive.
Again, something which could be more clearly documented.
> Are there any possibilities to debug where the error lies?
Well, short of adding a few debug statements, I don't think so.
So, for the way forward, I'll try to find some time this evening to fix
the docs and I could also commit the changes I've done on the
plugins/1.0/spam-filter if you're OK with that.
-- Christian