Both 'quickly package --extras' and 'quickly submitubuntu' correctly install translations for applications in /opt/extras.ubuntu.com/appname/share/locale.
However, there is an additional step required to make applications to actually use those translations at runtime: use the bindtextdomain() call to specify that they should be loaded from /opt instead of /usr/share/locale.
Quickly's gettext setup is originally:
import gettext
from gettext import gettext as_
gettext.textdomain('appname')
And this should be changed to the following for apps in extras:
TEXTDOMAIN = 'appname'
LOCALEDIR = '/opt/extras.ubuntu.com/appname/share/locale'
import locale
from locale import gettext as _
locale.bindtextdomain(TEXTDOMAIN, LOCALEDIR)
locale.textdomain(TEXTDOMAIN)
Notice the use of the locale module (Python's C gettext API) instead of the gettext module (pure Python gettext API). This is needed to make Gtk.Builder() load translations in /opt.
I wonder whether the gettext initialization could be moved to a single place/module, rather than added to each .py file as it is done now. This would probably help if the implementation of 'quickly package --extras' or 'quickly submitubuntu' would rely on adding a patch to modify those lines of code or simply do text substitution.
This still does not take care of the translations for schemas and PolicyKit files in /opt (they should be filed as separate bugs), but at least gets us 90% there in being able to run localized apps from /opt
Both 'quickly package --extras' and 'quickly submitubuntu' correctly install translations for applications in /opt/extras. ubuntu. com/appname/ share/locale.
However, there is an additional step required to make applications to actually use those translations at runtime: use the bindtextdomain() call to specify that they should be loaded from /opt instead of /usr/share/locale.
Quickly's gettext setup is originally:
import gettext textdomain( 'appname' )
from gettext import gettext as_
gettext.
And this should be changed to the following for apps in extras:
TEXTDOMAIN = 'appname' ubuntu. com/appname/ share/locale' bindtextdomain( TEXTDOMAIN, LOCALEDIR) textdomain( TEXTDOMAIN)
LOCALEDIR = '/opt/extras.
import locale
from locale import gettext as _
locale.
locale.
Notice the use of the locale module (Python's C gettext API) instead of the gettext module (pure Python gettext API). This is needed to make Gtk.Builder() load translations in /opt.
I wonder whether the gettext initialization could be moved to a single place/module, rather than added to each .py file as it is done now. This would probably help if the implementation of 'quickly package --extras' or 'quickly submitubuntu' would rely on adding a patch to modify those lines of code or simply do text substitution.
This still does not take care of the translations for schemas and PolicyKit files in /opt (they should be filed as separate bugs), but at least gets us 90% there in being able to run localized apps from /opt
See more details on http:// askubuntu. com/questions/ 140552/ how-to- make-glade- load-translatio ns-from- opt
ProblemType: Bug ature: Ubuntu 3.2.0-24.37-generic 3.2.14 dules: nvidia ture: all dpm/quickly- templates/ ubuntu- application- qt quickly/ templates/ unity-lens quickly/ templates/ ubuntu- application quickly/ templates/ ubuntu- flash-game quickly/ templates/ ubuntu- cli sDirectories: dpm/quickly- templates quickly/ templates/
DistroRelease: Ubuntu 12.04
Package: quickly 12.04-0ubuntu1
ProcVersionSign
Uname: Linux 3.2.0-24-generic x86_64
NonfreeKernelMo
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
Date: Wed May 23 23:35:20 2012
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20110319)
PackageArchitec
QuicklyDataPath: /usr/share/quickly
QuicklyTemplates:
/home/
/usr/share/
/usr/share/
/usr/share/
/usr/share/
QuicklyTemplate
/home/
/usr/share/
SourcePackage: quickly
UpgradeStatus: No upgrade log present (probably fresh install)