#9291 closed defect (fixed)
language switching in Preferences has no effect
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | i18n | Version: | 0.12b1 |
Severity: | normal | Keywords: | preferences, setuptools |
Cc: | leho@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I just:
- upgraded a trac 0.11.7 to 0.12b1 (with mod_python) where I have a user login
- created a fresh trac 0.12b1 environment which I started as standalone (without user permission _> using only anonymous)
I can change the language in Preferences from default to German but nothing happens.
I have genshi 0.6 babel 0.9.5 installed.
My trac is istalled as:
/usr/local/lib/python2.6/site-packages/Trac-0.12b1-py2.6.egg
… so its still compressed and the localisation *.mo files are inside the egg.
Is this a problem for babel??
Attachments (1)
Change History (25)
comment:1 by , 15 years ago
Cc: | added |
---|
follow-up: 3 comment:2 by , 15 years ago
comment:3 by , 15 years ago
Replying to anonymous:
Hi, after several attempts I managed to have trac user interface translated in my locale language (italian). In order to do that, I :
- installed Babel and Gneshi as usual (just typed easy_install Babel Genshi)
- installed Trac 12b1 from source as described here: http://trac.edgewall.org/wiki/TracInstall#Fromsource
Please pay attention to run the command
python ./setup.py compile_catalog -fbefore the command
python ./setup.py install
I forgot to say that after this procedure switching the language in preferences do work right!!
follow-up: 9 comment:4 by , 15 years ago
This is already documented on TracInstall.
Should we close this?
comment:5 by , 15 years ago
I'd like to check first if installing via easy_install
works as expected.
comment:6 by , 15 years ago
OK I reinstalled from source, now it works.
To be mentioned:
- before reinstalling I had to delete Trac-0.12b1-py2.6.egg
from the site-packages dir and delete the line "
./Trac-0.12b1-py2.6.egg
" from the Trac-0.12b1-py2.6.egg file.
Otherwise the install aborts with an error. - it would be nice to mention the
python ./setup.py compile_catalog -f
in the INSTALL file.
You can close it … I leave it open since you wanted to test something.
From my point of view its OK ;-)
follow-up: 10 comment:7 by , 15 years ago
Summary: | language switching in Pfererences has no effect → language switching in Prererences has no effect |
---|
The .tar.gz and .zip files don't contain the .mo files. I'll regenerate them.
Besides, I've been suggested that we should make the compilation of catalog a more implicit step, triggered by an install
.
Maybe a new build_mo
command, which would do a compile_catalog
if Babel is installed?
build_mo
could not only triggered by an install
, but also by an sdist
.
comment:8 by , 15 years ago
Summary: | language switching in Prererences has no effect → language switching in Preferences has no effect |
---|
one more try… ;-)
follow-up: 23 comment:9 by , 15 years ago
Replying to Carsten Klein <carsten.klein@…>:
This is already documented on TracInstall.
Should we close this?
You're right, it is already documented on that page but I think that it is a bit confused. For a user like me was not obvious the fact that to obtain the translation it's mandatory to install trac from source.
By the way right now i'm using the 12b1 and I have to say that it's great. Good job!!
follow-up: 11 comment:10 by , 15 years ago
Replying to cboos:
The .tar.gz and .zip files don't contain the .mo files.
I can confirm that. Installing with easy_install
downloads the .zip
and runs bdist_egg
, and the resulting egg doesn't contain any .mo
files either.
comment:11 by , 15 years ago
Replying to rblank:
Replying to cboos:
The .tar.gz and .zip files don't contain the .mo files.
I can confirm that. Installing with
easy_install
downloads the.zip
and runsbdist_egg
, and the resulting egg doesn't contain any.mo
files either.
Even worse, I've not managed yet to convince setuptools to integrate the .mo files when they're present, it just ignores them even when there's an explicit trac/locale/*/LC_MESSAGES/*.mo
pattern in install_data
in setup.py
…
comment:12 by , 15 years ago
comment:13 by , 15 years ago
Triggering a compile_catalog
as the first step of a build
is easy:
-
setup.py
18 18 19 19 try: 20 20 import babel 21 from distutils.command.build import build 22 21 23 extractors = [ 22 24 ('**.py', 'python', None), 23 25 ('**/templates/**.html', 'genshi', None), … … 28 30 'trac': extractors, 29 31 'tracopt': extractors, 30 32 } 33 build.sub_commands.insert(0, ('compile_catalog', lambda x:True)) 31 34 except ImportError: 32 35 pass
With the above, bdist_wininst
does the right thing, the .mo
files are already there when build_py
copies the package_data below build/.
But unfortunately, bdist_egg
doesn't run a build
command…
by , 15 years ago
Attachment: | t9291-compile_catalog-first.patch added |
---|
ensure compile_catalog
command is called before bdist_wininst
and bdist_egg
comment:14 by , 15 years ago
Please test the above patch. In particular, I'd be curious to know whether this works with Distribute or not.
follow-up: 20 comment:15 by , 15 years ago
Two issues with this:
- The trac.log should contain hints that locale does not work due to missing catalogs.
- The install target should not install .po-files. In a release environment po files have no reason to exist.
comment:16 by , 15 years ago
I can confirm that t9291-compile_catalog-first.patch works on Linux with Distribute:
- Created an
.egg
andeasy_install
ed it. The translations work. - Created a source distribution and
easy_install
ed it. The translations work.
However, as mentioned in comment:15, the .egg
contains the .po
and .pot
files, which are not needed. The following additional patch fixes that, and the resulting source and egg distributions still work correctly.
-
setup.py
diff --git a/setup.py b/setup.py
a b 61 74 package_data = { 62 75 '': ['templates/*'], 63 76 'trac': ['htdocs/*.*', 'htdocs/README', 'htdocs/js/*', 'htdocs/css/*', 64 'htdocs/guide/*', 'locale/* .*', 'locale/*/LC_MESSAGES/*.*'],77 'htdocs/guide/*', 'locale/*/LC_MESSAGES/*.mo'], 65 78 'trac.wiki': ['default-pages/*'], 66 79 'trac.ticket': ['workflows/*.ini'], 67 80 },
comment:17 by , 15 years ago
Ok, as long as the sdist keeps the .po files, it's fine.
Patch + addendum from comment:16 applied in r9638.
Keeping the ticket opened until the TracInstall doc is updated.
comment:18 by , 15 years ago
Actually, the .pot
file is not needed at run time either, that's why I removed the locale/*.*
item in comment:16.
comment:20 by , 15 years ago
Component: | general → i18n |
---|---|
Keywords: | preferences setuptools added |
Resolution: | → fixed |
Status: | new → closed |
Replying to anonymous:
Two issues with this:
- The trac.log should contain hints that locale does not work due to missing catalogs.
That would be tricky to do, and is not really useful: if you have Babel correctly installed (as visible in the About Trac / Config view for example) but you don't have localization working, then it's because the compiled catalogs have not been installed… Which should be rare now, as the present issue has been fixed.
- The install target should not install .po-files. In a release environment po files have no reason to exist.
Besides, another nice effect of the changes from comment:14 is that the list of available languages is now restricted to the languages for which there is a compiled catalog…
E.g. Vietnamese, Farsi, Spanish and Greek are not listed, as they all have some fuzzy translations and hence were skipped by compile_catalog
(which is good).
So if you don't have catalogs, you also don't have the possibility to select the corresponding language (this apply to post-r9640 versions, of course).
comment:21 by , 15 years ago
Owner: | set to |
---|
comment:22 by , 15 years ago
Forgot to add: for those who have installed 0.12b1 via easy_install
and can't wait for the next release (0.12rc1), simply do:
easy_install Trac==dev
comment:23 by , 15 years ago
Replying to hope:
You're right, it is already documented on that page but I think that it is a bit confused. For a user like me was not obvious the fact that to obtain the translation it's mandatory to install trac from source.
You are right, too. I for my part am working with a non translated version since I totally overlooked it on the wiki. Perhaps moving the paragraph up by one would do the trick, so that lazy people like us will eventually overread it ;)
comment:24 by , 10 years ago
Keywords: | preferences setuptools → preferences, setuptools |
---|
Hi, after several attempts I managed to have trac user interface translated in my locale language (italian). In order to do that, I :
Please pay attention to run the command
before the command