From 2481c04480e594f385945dcab6822b2b4f227f34 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jan 2012 19:12:15 +0100 Subject: Mat's can now be localised ! --- mat-gui | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'mat-gui') 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')) if response is 0: # gtk.STOCK_OK filenames = chooser.get_filenames() - task = self.__populate(filenames) + task = self.populate(filenames) gobject.idle_add(task.next) # asynchrone processing chooser.destroy() - def __populate(self, filenames): + def populate(self, filenames): ''' Append selected files by add_file to the self.liststore ''' @@ -461,7 +461,7 @@ non-anonymised) file to output archive')) ''' urls = selection.data.strip('\r\n\x00') # strip stupid characters cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n')) - task = self.__populate(cleaned_urls) + task = self.populate(cleaned_urls) gobject.idle_add(task.next) # asynchrone processing def __clean_draged_file_path(self, url): @@ -676,11 +676,27 @@ class TreeViewTooltips(object): name = model[path][0] return name.file.filename + +def translate(): + '''' + Handle L10N of mat-gui + ''' + # get system's language + current_lang, _ = locale.getdefaultlocale() + if current_lang: + langs = [current_lang] + + # get the $LANG environnement's variable + language = os.environ.get('LANG', None) + if language: + print language + langs += language.split(':') + + return gettext.translation('mat-gui', 'locale', langs, fallback=True).ugettext + + if __name__ == '__main__': - #Translations - t = gettext.translation('gui', 'locale', fallback=True) - _ = t.ugettext - t.install() + _ = translate() #Main gui = GUI() @@ -688,7 +704,7 @@ if __name__ == '__main__': #Add files from command line infiles = [arg for arg in sys.argv[1:] if os.path.exists(arg)] if infiles: - task = gui.__populate(infiles) + task = gui.populate(infiles) gobject.idle_add(task.next) gtk.main() -- cgit v1.3 From 9bad7d4ac4916b4ffeb528dea8ee4f1959f2f7fd Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 9 Jan 2012 22:49:54 +0100 Subject: Remove a debug instruction --- mat-gui | 1 - 1 file changed, 1 deletion(-) (limited to 'mat-gui') diff --git a/mat-gui b/mat-gui index 7561dd0..0c047f7 100755 --- a/mat-gui +++ b/mat-gui @@ -689,7 +689,6 @@ def translate(): # get the $LANG environnement's variable language = os.environ.get('LANG', None) if language: - print language langs += language.split(':') return gettext.translation('mat-gui', 'locale', langs, fallback=True).ugettext -- cgit v1.3