Ticket #1631 (closed enhancement: fixed)
locale directory is not found automatically
| Reported by: | chrisz | Owned by: | anonymous |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.5 |
| Component: | TurboGears | Version: | 1.0.4b3 |
| Severity: | normal | Keywords: | locale |
| Cc: |
Description
Comment from rejoc in #1382: "locales are used only when starting the application with the main directory (the one with start-xxx.py) as the default directory. No translations if starting from elsewhere."
I can reproduce this problem with the latest version (1.0.4b3, r3831). The locales are only used then started from the project directory or when i18n.locale_dir is set (this is impractical, since the path is usually something like '/usr/local/lib/python/site-packages/my_project-0.4-py2.5.egg/locales', i.e. depends on the version number etc. - it really should be found automatically).
Change History
comment:2 Changed 5 years ago by amit
Hello Chris,
Why it's changed to milestone 1.1? I think it was working with v1.0.3.2 but not with v1.0.4.4 and must be fixed in branch 1.0...
The work-around to this problem is to update the configuration with package=packagename. We did this in command.py just before starting the app...
from turbogears import config from turbogears.i18n import tg_gettext localedir = tg_gettext.get_locale_dir() if not localedir: config.update(dict(package='hello'))
- Amit Mendapara
comment:3 Changed 5 years ago by Chris Arndt
Because we only want to fix important and security relevant issues in TG 1.0. Otherwise we will never get around to finish TG 1.1.
There is a workaround for this bug, so it's not so important, IMHO.
comment:4 Changed 5 years ago by chrisz
- Status changed from new to closed
- Resolution set to fixed
This problem bugged me for long enough in my TG 1.0 projects, so I consider it important to get this fixed. The workaround is nice, but most people are probably not aware of this.
I think the very simple fix is to set the package name in the quickstarted app.cfg. It has the package name hardcoded in some places anyway, so I see no drawback in doing so, and it works nicely for me. I've checked this in already, so this will be fixed in TG 1.0.5.