summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2012-01-08 19:12:15 +0100
committerjvoisin2012-01-08 19:12:15 +0100
commit2481c04480e594f385945dcab6822b2b4f227f34 (patch)
tree001211112f51d24ceff6b75787231dd99929e18f
parent153d8d446603250085b384fda1a08e6a7267c7d7 (diff)
Mat's can now be localised !
-rwxr-xr-xmat-gui32
1 files changed, 24 insertions, 8 deletions
diff --git a/mat-gui b/mat-gui
index 380e4d8..7561dd0 100755
--- a/mat-gui
+++ b/mat-gui
@@ -262,11 +262,11 @@ data loss, but clean more efficiently'))
262 262
263 if response is 0: # gtk.STOCK_OK 263 if response is 0: # gtk.STOCK_OK
264 filenames = chooser.get_filenames() 264 filenames = chooser.get_filenames()
265 task = self.__populate(filenames) 265 task = self.populate(filenames)
266 gobject.idle_add(task.next) # asynchrone processing 266 gobject.idle_add(task.next) # asynchrone processing
267 chooser.destroy() 267 chooser.destroy()
268 268
269 def __populate(self, filenames): 269 def populate(self, filenames):
270 ''' 270 '''
271 Append selected files by add_file to the self.liststore 271 Append selected files by add_file to the self.liststore
272 ''' 272 '''
@@ -461,7 +461,7 @@ non-anonymised) file to output archive'))
461 ''' 461 '''
462 urls = selection.data.strip('\r\n\x00') # strip stupid characters 462 urls = selection.data.strip('\r\n\x00') # strip stupid characters
463 cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n')) 463 cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n'))
464 task = self.__populate(cleaned_urls) 464 task = self.populate(cleaned_urls)
465 gobject.idle_add(task.next) # asynchrone processing 465 gobject.idle_add(task.next) # asynchrone processing
466 466
467 def __clean_draged_file_path(self, url): 467 def __clean_draged_file_path(self, url):
@@ -676,11 +676,27 @@ class TreeViewTooltips(object):
676 name = model[path][0] 676 name = model[path][0]
677 return name.file.filename 677 return name.file.filename
678 678
679
680def translate():
681 ''''
682 Handle L10N of mat-gui
683 '''
684 # get system's language
685 current_lang, _ = locale.getdefaultlocale()
686 if current_lang:
687 langs = [current_lang]
688
689 # get the $LANG environnement's variable
690 language = os.environ.get('LANG', None)
691 if language:
692 print language
693 langs += language.split(':')
694
695 return gettext.translation('mat-gui', 'locale', langs, fallback=True).ugettext
696
697
679if __name__ == '__main__': 698if __name__ == '__main__':
680 #Translations 699 _ = translate()
681 t = gettext.translation('gui', 'locale', fallback=True)
682 _ = t.ugettext
683 t.install()
684 700
685 #Main 701 #Main
686 gui = GUI() 702 gui = GUI()
@@ -688,7 +704,7 @@ if __name__ == '__main__':
688 #Add files from command line 704 #Add files from command line
689 infiles = [arg for arg in sys.argv[1:] if os.path.exists(arg)] 705 infiles = [arg for arg in sys.argv[1:] if os.path.exists(arg)]
690 if infiles: 706 if infiles:
691 task = gui.__populate(infiles) 707 task = gui.populate(infiles)
692 gobject.idle_add(task.next) 708 gobject.idle_add(task.next)
693 709
694 gtk.main() 710 gtk.main()