Ticket #1631 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

locale directory is not found automatically

Reported by: chrisz Assigned to: 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

01/21/08 08:24:47 changed by Chris Arndt

  • milestone changed from 1.0.4 to 1.1.

06/23/08 03:25:39 changed 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

06/23/08 05:40:41 changed 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.

06/25/08 08:33:06 changed 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.