Merge lp:~dpm/quickly/extras into lp:~mterry/quickly/extras

Proposed by David Planella
Status: Merged
Approved by: Michael Terry
Approved revision: 673
Merge reported by: Michael Terry
Merged at revision: not available
Proposed branch: lp:~dpm/quickly/extras
Merge into: lp:~mterry/quickly/extras
Diff against target: 21 lines (+11/-0)
1 file modified
data/templates/ubuntu-application/internal/packaging.py (+11/-0)
To merge this branch: bzr merge lp:~dpm/quickly/extras
Reviewer Review Type Date Requested Status
Michael Terry Approve
Review via email: mp+107285@code.launchpad.net

Description of the change

Fix for bug 1003818 - gettext is now correctly initialized with the right locale directory for /opt when invoking the package --extras command.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Awesome, thanks! I made some tiny changes (like using -Z for grep and -r for sed) and added a test for your change.

review: Approve
Revision history for this message
David Planella (dpm) wrote :

Excellent, thanks Mike, and sorry for the missing test, but it seems you're on top of things already!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/templates/ubuntu-application/internal/packaging.py'
2--- data/templates/ubuntu-application/internal/packaging.py 2012-05-23 19:53:27 +0000
3+++ data/templates/ubuntu-application/internal/packaging.py 2012-05-24 21:12:20 +0000
4@@ -242,6 +242,17 @@
5 'new_desktop_debdir': new_desktop_debdir, 'project_name': project_name,
6 'opt_root': opt_root, 'new_desktop_debpath': new_desktop_debpath}
7
8+ # Set gettext's bindtextdomain to point to /opt and use the locale
9+ # module (gettext's C API) instead of the gettext module (gettext's Python
10+ # API), so that translations are loaded from /opt
11+ localedir = os.path.join(opt_root, 'share/locale')
12+ install_rules += """
13+ grep -Rl 'import gettext' debian/%(project_name)s/* | xargs -0 sed -i 's|\(import\) gettext$$|\\1 locale|'
14+ grep -Rl 'from gettext import gettext as _' debian/%(project_name)s/* | xargs -0 sed -i 's|from gettext \(import gettext as _\)|from locale \\1|'
15+ grep -Rl "gettext.textdomain('%(project_name)s')" debian/%(project_name)s/* | xargs -0 sed -i "s|gettext\(\.textdomain('%(project_name)s')\)|locale\.bindtextdomain('%(project_name)s', '%(localedir)s')\\nlocale\\1|" """ % {
16+ 'project_name': project_name, 'localedir': localedir}
17+
18+
19 # We install a python_nameconfig.py file that contains a pointer to the
20 # data directory. But that will be determined by setup.py, so it will be
21 # wrong (python-mkdebian's --prefix command only affects where it moves

Subscribers

People subscribed via source and target branches

to all changes: