diff options
| author | intrigeri | 2012-05-16 11:15:32 +0200 |
|---|---|---|
| committer | jvoisin | 2012-05-17 13:26:37 +0200 |
| commit | adf403ca6adc1bdbd40e35237c4d75548b3f6c74 (patch) | |
| tree | 6986f1cb791bc4dc3c4fdaa8cf7ed0be5cae611c /mat-gui | |
| parent | 4160c14f22e124c9fa0ed141e2409ca66de903d9 (diff) | |
Have gettext find translations where they are, and don't duplicate its work.
Without running gettext.install, the gettext module did not find .mo files where
they live. So, let's add an incantation thereof.
Once this is done, Python's gettext defines a "_" function all by itself,
so we can get rid of the hand-crafted one that's now obsolete.
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 21 |
1 files changed, 1 insertions, 20 deletions
| @@ -565,27 +565,8 @@ non-anonymised) file to output archive')) | |||
| 565 | self.statusbar.push(0, _('Ready')) | 565 | self.statusbar.push(0, _('Ready')) |
| 566 | yield False | 566 | yield False |
| 567 | 567 | ||
| 568 | |||
| 569 | def translate(): | ||
| 570 | '''' | ||
| 571 | Handle L10N of mat-gui | ||
| 572 | ''' | ||
| 573 | # get system's language | ||
| 574 | current_lang, _ = locale.getdefaultlocale() | ||
| 575 | if current_lang: | ||
| 576 | langs = [current_lang] | ||
| 577 | |||
| 578 | # get the $LANG environnement's variable | ||
| 579 | language = os.environ.get('LANG', None) | ||
| 580 | if language: | ||
| 581 | langs += language.split(':') | ||
| 582 | |||
| 583 | return gettext.translation('MAT', 'locale', langs, | ||
| 584 | fallback=True).ugettext | ||
| 585 | |||
| 586 | |||
| 587 | if __name__ == '__main__': | 568 | if __name__ == '__main__': |
| 588 | _ = translate() | 569 | gettext.install('MAT', unicode=True) |
| 589 | 570 | ||
| 590 | #Main | 571 | #Main |
| 591 | gui = GUI() | 572 | gui = GUI() |
