On Thu, Oct 17, 2013 at 10:22 AM, Saint Germain <[email protected]> wrote:

> On Thu, 17 Oct 2013 10:01:47 -0700, Ryan Ollos
> <[email protected]> wrote :
>
> > > > >> I am evaluating Bloodhound (current trunk version and on Debian
> > > > >> Testing) and here are a few feedbacks:
> > > > >>
> > > > >> 1) It seems that that we are missing trac/htdocs/js/messages
> > > > >> contents (typically en_us.js)
> > > > >> Indeed these javascript files are requested by line 983 of
> > > > >> trac/web/chrome.py:
> > > > >> if req.locale is not None:
> > > > >>   add_script(req, 'common/js/messages/%s.js' % req.locale)
> > > > >>
> > > > >
> > > > > I've noticed this as well, but will have to investigate.
> > > > >
> > > >
> > > > This will happen if the message catalogs are not compiled. If
> > > > that is the case, you'll also likely notice that navigating
> > > > to /prefs/language and changing the language has no effect. As
> > > > you've noted already, once the message catalogs are compiled, you
> > > > should find:
> > > >
> > > > ls trac/htdocs/js/messages/
> > > > ca.js     en_US.js  es_MX.js  he.js  ja.js  pt_BR.js  tr.js
> > > > da.js     eo.js     et.js     hu.js  ko.js  ru.js     uk.js
> > > > de.js     es_AR.js  fi.js     hy.js  nb.js  sl.js     zh_CN.js
> > > > en_GB.js  es.js     fr.js     it.js  nl.js  sv.js     zh_TW.js
> > > >
> > > >
> > > > If you install in development mode, the message catalogs will not
> > > > be compiled. To compile them, you can cd to the trac sources
> > > > directory and run "python setup.py install".
> > > >
> > > > If you did not install in development mode, then we need to figure
> > > > out why the message catalogs are not compiled. I suppose there
> > > > could be a problem with your Babel install.
> > > >
> > > >
> > >
> > > Hello,
> > >
> > > Yes indeed, I was following the instructions from here:
> > > https://issues.apache.org/bloodhound/wiki/BloodhoundContributing
> > >
> > > Trac through this command:
> > > pip install -r requirements-dev.txt
> > >
> > > I manually installed Trac with setup.py install and
> > > trac/htdocs/js/messages/ was generated.
> > >
> > > Thanks !
> > >
> >
> > Now that you've reminded me, a while back I added a note about the
> > issue to
> >
> https://issues.apache.org/bloodhound/wiki/BloodhoundContributing#GettingTheSource
> >
> > "The message catalogs won't be compiled and therefore language
> > translations won't be available since Trac has been installed in
> > editable/develop mode."
> >
> > The note is probably not too obvious. Maybe we can put it in a box
> > labeled "hint". I can't remember if we have a way to do this already.
> > Olemis, do you know?
>
> Well I _did_ read the first few words but skipped the rest as I didn't
> want localization at first (english is fine for the moment). But it
> seems that somehow in my setup en_US is processed as a local to be
> translated ?


I'm not sure why message catalogs are generated for en_US, but I'm going to
guess and say that Babel must not know what the "base" language is. All of
the `msgstr`s in that file are empty, so it appears to have no effect.

Ideally though, Trac wouldn't try to add the js file when the messages
catalogs aren't available. Presently the Trac codebase acts as if
translations are available when Babel is detected. I've seen situations
where it only shows English as an available language, and others when all
the languages are shown. For the latter, this leads to the confusing
behavior I mentioned earlier, whereby the Language preferences panel
presents a list of languages when the message catalogs are not available,
and changing the active language leaves everything in English. I haven't
sorted out exactly the conditions that lead to each situation, but a
possible improvement to Trac would be to have it behave as if localizations
are available only when the message catalogs are available.


> > One additional note, you'll want to run "python setup.py develop"
> > again after "python setup.py install" in order to recreate the egg in
> > "development mode", which creates a symbolic link to the source and
> > your Trac instance will be automatically updated when tracd
> > auto-restarts after you edit the code. This allows you to edit the
> > code, refresh the page and immediately see the changes.
>
> Thanks for the heads-up !
>

The other thing I'm reminded of now is that BloodhoundContributing shows a
better way to do this. Executing `python setup.py compile_catalog -f`
avoids the need to run `setup.py` twice, the second execution switching the
environment back to development mode.

Reply via email to