I created an application using quickly create ubuntu-application myapp.
Then I created translations and created deb package quickly package to install and test it. When I run myapp all strings from glade files were translated but all strings from code were not translated. What's this? How to solve this problem ?
Asked
Active
Viewed 133 times
1
Denis Kovalskiy
- 41
- 3
2 Answers
2
I've solved this. I must use locale.gettext instead of gettext. I don't know what the difference is, but it works.
Eliah Kagan
- 119,640
Denis Kovalskiy
- 41
- 3
1
In your code, you need to mark all your strings for translation by enclosing them in _(). E.g.:
import gettext
from gettext import gettext as _
gettext.textdomain('yourappname')
some_string = 'This is not a translatable string'
some_other_string = _('This is a translatable string')
Notice the gettext statements above, which Quickly puts in each source file. You'll need to add them to any source file that contains translatable strings.
David Planella
- 15,610