This is my first trial in translating pygtk
glade
; I have created Rockdome.mo file on the following dir:./locale/ar/LC_MESSAGES/Rockdome.mo
def apply_locale(self , lang):
domain = "Rockdome"
local_path = basefolder+"/locale" # basefolder is the current dir
lang = gettext.translation('Rockdome', local_path , languages=['%s'%lang])
lang.install()
_ = lang.gettext
print _("Close") # the output is اغلاق which is correct arabic translation!!
but the application still appear in the default system lamnguage EN
; What I missing ??
EDIT
After searching in pygtk and buider tutoial; I found 2 methods to tell gtk
& builder
How to bring text :
the first from here :
for module in (gettext, gtk.glade):
module.bindtextdomain(APP_NAME, LOCALE_DIR)
module.textdomain(APP_NAME)
which fail.
The second from here
self.builder.set_translation_domain('Rockdome')
print self.builder.get_translation_domain() # the output is "Rockdome"
which also fail !!, the application still untranslated !!
N.B: I guess that
builder
needs to know the location for my local path to search in it not in the default paths so I copied./local/ar/LC_MESSAGES/Rockdome.mo
to/usr/share/locale/ar/LC_MESSAGES/Rockdome.mo
which also failed.