Ticket #1382 (closed defect: fixed)
[PATCH] Don't forget locales directory in setup.py
| Reported by: | chrisz | Owned by: | faide |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.5 |
| Component: | TurboGears | Version: | 1.0.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
When you deploy a TurboGears project as an egg, as described here, the locales directory will get lost.
The patch (against the current trunk) makes sure that the locales directory is installed along with the project package.
Attachments
Change History
Changed 5 years ago by chrisz
-
attachment
setup_with_locale.patch
added
comment:1 Changed 5 years ago by chrisz
The patch now includes an improvement of the get_package_name() function so that it does not get disturbed by the "locales" top level package.
comment:2 Changed 5 years ago by chrisz
One problem is still open, however: Though the locales directory is now installed together with the egg, it is not found when running the application, unless you start the application from inside the egg directory or set the locales path explicitly with i18n.locale_dir. This is because the tg_gettext module looks for a "locales" directory in the current working directory if no path is explicitly set.
comment:3 Changed 5 years ago by faide
This patch applies to 1.0 but does not apply cleanly to trunk... ;( I'm too tired right now. I'll look into the trunk tomorrow... applied in 1.0 (r3031)
Thanks.
Changed 5 years ago by chrisz
-
attachment
extended_locales.patch
added
Extended patch that also solves the problem of finding the locales directory
comment:5 Changed 5 years ago by chrisz
Right, the patch is for the 1.0 branch only and may need some modification for the trunk.
I have now added an extended patch that also solves the problem mentioned in the last comment. The idea is to put the package name into the config in the start script, and then look for the locales directory in the parent dir of of the package path. Not sure whether this is really a good solution, but it works for me.
comment:6 Changed 5 years ago by faide
The second patch seems to have been already applied. Someone did this without commenting the ticket ?
Anyway, thanks Chrisz!
comment:8 Changed 5 years ago by faide
OK, 1.0 now contains both patches (at r3063); but trunk is still too much of a mess ATM.
comment:9 Changed 5 years ago by jtate
This needs to handle projects without "locale" in their setup.py before it can be shipped in the 1.0.x branch. Please address this, or I will revert the patches.
comment:10 Changed 5 years ago by jtate
I'll clarify: When running my test suite against the 1.0 branch, get_package_name() returns None. This causes tg_gettext to fail when attempting to find substitutions for _() stuff.
Changed 5 years ago by chrisz
-
attachment
no_package_problem.patch
added
addresses comment 06/07/07 13:27:31 by jtate
comment:11 Changed 5 years ago by chrisz
Does the newly attached patch solve this issue?
comment:12 Changed 5 years ago by jtate
It's closer. I apologize for not giving you a good test case earlier. Please see the attached.
Changed 5 years ago by jtate
-
attachment
brokensample.tgz
added
Simple case 0, extract, and run the script.
Changed 5 years ago by jtate
-
attachment
brokensample2.tgz
added
Broken sample 1, extract, cd separatetests, run testscript.sh
Changed 5 years ago by chrisz
-
attachment
no_package_problem_2.patch
added
addresses comment 06/07/07 20:46:31 by jtate
comment:13 Changed 5 years ago by chrisz
Thanks. I have attached an improved no_package_problem_2.patch
comment:14 Changed 5 years ago by jtate
no_package_problem_2 applied to 1.0 branch. faide can you take it from here to make sure it gets into trunk?
comment:16 Changed 4 years ago by rejoc
Another issue :
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.
comment:17 Changed 4 years ago by chrisz
- Status changed from new to closed
- Resolution set to fixed
The patch has been included in TG 1.0 and 1.1 since r3063. In the trunk (TG 2.0) i18n needs to be reimplemented anyway. So I'm closing this now.
We can open a new ticket for the issue mentioned in the last comment.
Adds locales directory to setup.py and improve get_package_name in util.py