Modify

Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#7314 closed defect (invalid)

Building egg from trunk misses locale files

Reported by: todd.radel@… Owned by: Robert Corsaro
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords: i18n locale compile_catalog
Cc: Trac Release: 0.12

Description

I checked the trunk out of SVN and issued:

python setup.py bdist_egg

and copied the egg to my development server. When the system tries to send an announcement, I get an error KeyError: announcer\locale. The egg is missing the locale subdirectory. I fixed it by making a small change in setup.py at line 72:

            'locale/*.*',
            'locale/de/LC_MESS AGES/*.po',

(Note: added a space in LC_MESS AGES to fool the spam filter.)

Attachments (0)

Change History (5)

comment:1 Changed 15 years ago by anonymous

Full traceback on the error message:

2010-06-29 13:31:30,855 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\web\main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "build\bdist.win32\egg\trac\web\main.py", line 235, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\trac\ticket\web_ui.py", line 169, in process_request
    return self._process_ticket_request(req)
  File "build\bdist.win32\egg\trac\ticket\web_ui.py", line 538, in _process_ticket_request
    self._do_save(req, ticket, action)
  File "build\bdist.win32\egg\trac\ticket\web_ui.py", line 1233, in _do_save
    cnum=internal_cnum):
  File "build\bdist.win32\egg\trac\ticket\model.py", line 353, in save_changes
    listener.ticket_changed(self, comment, author, old_values)
  File "d:\trac\ba7new\plugins\announcerplugin-0.12_p2.dev-py2.6.egg\announcer\producers\ticket.py", line 92, in ticket_changed
    announcer = AnnouncementSystem(ticket.env)
  File "build\bdist.win32\egg\trac\core.py", line 119, in maybe_init
    init(self)
  File "d:\trac\ba7new\plugins\announcerplugin-0.12_p2.dev-py2.6.egg\announcer\api.py", line 331, in __init__
    locale_dir = pkg_resources.resource_filename(__name__, 'locale')
  File "C:\Python26\lib\site-packages\pkg_resources.py", line 882, in resource_filename
    self, resource_name
  File "C:\Python26\lib\site-packages\pkg_resources.py", line 1352, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "C:\Python26\lib\site-packages\pkg_resources.py", line 1363, in _extract_resource
    zip_stat = self.zipinfo[zip_path]
KeyError: announcer\locale

comment:2 Changed 15 years ago by Steffen Hoffmann

Keywords: i18n locale compile_catalog added
Resolution: invalid
Status: newclosed

Thanks for !testing and taking care of new localization capabilities in the first place.

Regarding your report this is not a bug, this is the feature.

Think twice, please: PO files are verbatim translations for development, but MO are what gettext will use in the end. If you get an error complaining about missing locale dir, this is only for the fact, that you missed to actually compile any catalog with

python ./setup.py compile_catalog

before you make the egg or do system-wide install. With a PO in your egg you'd never see any translated text. So the error is correct, your complaint and proposed solution is invalid. Did you try with your modification? Certainly not. But you are not alone, this is similar to #7220.

I would have happily accepted a documentation bug against the wiki page, because I did give no pointer for novice in the field of i18n/l10n. Look at wiki documentation, please, that is improved right now. And sorry for the inconvenience. I hope you'll not be distracted by now and continue on testing.

comment:3 Changed 15 years ago by Todd Radel

Whoops! Thanks for correcting me. Since my locale is US English, I'm not used to dealing with locale files. And yes, we will continue testing against the trunk. Thanks.

comment:4 Changed 13 years ago by Steffen Hoffmann

Sorry, recent history shows, that I stand corrected instead.

This will be fixed more reliably now by adding a placeholder file to the locale folder.

comment:5 Changed 13 years ago by Steffen Hoffmann

(In [10920]) AnnouncerPlugin: Refactor i18n in a more compatible way, refs #7314, #7666, #7380, #8062 and #9192.

Lessons learned meanwhile with other plugins, so the code applied here has actually been tested and proven to work. This reverts [8409] effectively, but let's keep proper Babel and Trac versions for i18n explicitly as an extra.

After these changes the plugin finally loads cleanly in Trac 0.11 again.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Robert Corsaro.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.