From 856c91c4838156a8381cf1377811866934df0922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sun, 19 Feb 2017 21:01:13 -0600 Subject: [PATCH] Added some translatable messages --- .../commands/commands/add_word_to_spell_check.py | 8 ++++---- src/fenrir/commands/commands/bookmark_1.py | 10 +++++----- src/fenrir/commands/commands/toggle_braille.py | 6 +++--- src/fenrir/commands/commands/toggle_emoticons.py | 6 +++--- .../commands/commands/toggle_highlight_tracking.py | 6 +++--- src/fenrir/commands/commands/toggle_output.py | 6 +++--- .../commands/commands/toggle_punctuation_level.py | 2 +- src/fenrir/commands/commands/toggle_sound.py | 6 +++--- src/fenrir/commands/commands/toggle_speech.py | 6 +++--- src/fenrir/commands/commands/toggle_tutorial_mode.py | 4 ++-- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/fenrir/commands/commands/add_word_to_spell_check.py b/src/fenrir/commands/commands/add_word_to_spell_check.py index 7b0a6277..1dd04982 100644 --- a/src/fenrir/commands/commands/add_word_to_spell_check.py +++ b/src/fenrir/commands/commands/add_word_to_spell_check.py @@ -24,14 +24,14 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'adds the current word to the exceptions dictionary' + return _('adds the current word to the exceptions dictionary') def updateSpellLanguage(self): self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') def run(self): if not initialized: - self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True) return if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: try: @@ -46,10 +46,10 @@ class command(): if currWord != '': if self.spellChecker.is_added(currWord): - self.env['runtime']['outputManager'].presentText(currWord + ' is already in dict',soundIcon='Cancel', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('{0} is already in dict').format(currWord,), soundIcon='Cancel', interrupt=True) else: self.spellChecker.add(currWord) - self.env['runtime']['outputManager'].presentText(currWord + ' added',soundIcon='Accept', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('{0} added').format(currWord,), soundIcon='Accept', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/bookmark_1.py b/src/fenrir/commands/commands/bookmark_1.py index d7426c43..4ddae198 100644 --- a/src/fenrir/commands/commands/bookmark_1.py +++ b/src/fenrir/commands/commands/bookmark_1.py @@ -16,18 +16,18 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'read Bookmark ' + self.ID + return _('read Bookmark {0}').format(self.ID,) def run(self): currApp = self.env['runtime']['applicationManager'].getCurrentApplication() if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText("Bookmark " + self.ID + "not set", interrupt=True) + self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) return if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) + self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) return if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText("Bookmark for application " + currApp + " not set", interrupt=True) + self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) return # set marks @@ -40,7 +40,7 @@ class command(): x, y, marked = \ line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) if marked.isspace(): - self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: self.env['runtime']['outputManager'].presentText(marked, interrupt=True) diff --git a/src/fenrir/commands/commands/toggle_braille.py b/src/fenrir/commands/commands/toggle_braille.py index 9aed3436..0929d489 100644 --- a/src/fenrir/commands/commands/toggle_braille.py +++ b/src/fenrir/commands/commands/toggle_braille.py @@ -14,14 +14,14 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'enables and disables output in braille' + return _('enables and disables output in braille') def run(self): if self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - self.env['runtime']['outputManager'].presentText("braille disabled", soundIcon='BrailleOff', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('braille disabled'), soundIcon='BrailleOff', interrupt=True) self.env['runtime']['settingsManager'].setSetting('braille', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'))) if self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - self.env['runtime']['outputManager'].presentText("braille enabled", soundIcon='BrailleOn', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('braille enabled'), soundIcon='BrailleOn', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_emoticons.py b/src/fenrir/commands/commands/toggle_emoticons.py index fc1872df..e44e6da3 100644 --- a/src/fenrir/commands/commands/toggle_emoticons.py +++ b/src/fenrir/commands/commands/toggle_emoticons.py @@ -13,14 +13,14 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'enables or disables announcement of emoticons insteed of chars' + return _('enables or disables announcement of emoticons instead of chars') def run(self): self.env['runtime']['settingsManager'].setSetting('general', 'emoticons', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'))) if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'): - self.env['runtime']['outputManager'].presentText("emoticons enabled", soundIcon='', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('emoticons enabled'), soundIcon='', interrupt=True) else: - self.env['runtime']['outputManager'].presentText("emoticons disabled", soundIcon='', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('emoticons disabled'), soundIcon='', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_highlight_tracking.py b/src/fenrir/commands/commands/toggle_highlight_tracking.py index 628e2448..a84a1860 100644 --- a/src/fenrir/commands/commands/toggle_highlight_tracking.py +++ b/src/fenrir/commands/commands/toggle_highlight_tracking.py @@ -13,7 +13,7 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'enables or disables tracking of highlighted' + return _('enables or disables tracking of highlighted') def run(self): currMode = self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') @@ -21,9 +21,9 @@ class command(): self.env['runtime']['settingsManager'].setSetting('focus', 'highlight', str(not currMode)) self.env['runtime']['settingsManager'].setSetting('focus', 'cursor', str(currMode)) if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - self.env['runtime']['outputManager'].presentText("highlight tracking", soundIcon='', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('highlight tracking'), soundIcon='', interrupt=True) else: - self.env['runtime']['outputManager'].presentText("cursor tracking", soundIcon='', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('cursor tracking'), soundIcon='', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_output.py b/src/fenrir/commands/commands/toggle_output.py index 95708651..378ba40c 100644 --- a/src/fenrir/commands/commands/toggle_output.py +++ b/src/fenrir/commands/commands/toggle_output.py @@ -14,13 +14,13 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'toggles all output settings' + return _('toggles all output settings') def run(self): if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled') or \ self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled') or \ self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - self.env['runtime']['outputManager'].presentText("fenrir muted", soundIcon='Accept', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('Fenrir muted'), soundIcon='Accept', interrupt=True) self.env['runtime']['settingsManager'].setSetting('speech', 'enabled','False') self.env['runtime']['settingsManager'].setSetting('sound', 'enabled','False') self.env['runtime']['settingsManager'].setSetting('braille', 'enabled','False') @@ -28,7 +28,7 @@ class command(): self.env['runtime']['settingsManager'].setSetting('speech', 'enabled','True') self.env['runtime']['settingsManager'].setSetting('sound', 'enabled','True') self.env['runtime']['settingsManager'].setSetting('braille', 'enabled','True') - self.env['runtime']['outputManager'].presentText("fenrir unmuted", soundIcon='Cancel', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('Fenrir unmuted), soundIcon='Cancel', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_punctuation_level.py b/src/fenrir/commands/commands/toggle_punctuation_level.py index b87789b8..257ff0f6 100644 --- a/src/fenrir/commands/commands/toggle_punctuation_level.py +++ b/src/fenrir/commands/commands/toggle_punctuation_level.py @@ -20,7 +20,7 @@ class command(): if self.env['runtime']['punctuationManager'].cyclePunctuation(): self.env['runtime']['outputManager'].presentText(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel'), interrupt=True, ignorePunctuation=True) else: - self.env['runtime']['outputManager'].presentText('No punctuation found.', interrupt=True, ignorePunctuation=True) + self.env['runtime']['outputManager'].presentText(_('No punctuation found.'), interrupt=True, ignorePunctuation=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_sound.py b/src/fenrir/commands/commands/toggle_sound.py index bc7c5a8a..8febec81 100644 --- a/src/fenrir/commands/commands/toggle_sound.py +++ b/src/fenrir/commands/commands/toggle_sound.py @@ -14,14 +14,14 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'enables or disables sound' + return _('enables or disables sound') def run(self): if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['outputManager'].presentText("sound disabled", soundIcon='SoundOff', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('sound disabled'), soundIcon='SoundOff', interrupt=True) self.env['runtime']['settingsManager'].setSetting('sound', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'))) if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['outputManager'].presentText("sound enabled", soundIcon='SoundOn', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('sound enabled'), soundIcon='SoundOn', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_speech.py b/src/fenrir/commands/commands/toggle_speech.py index 971c957e..83675c0e 100644 --- a/src/fenrir/commands/commands/toggle_speech.py +++ b/src/fenrir/commands/commands/toggle_speech.py @@ -14,14 +14,14 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'enables or disables speech' + return _('enables or disables speech') def run(self): if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].presentText("speech disabled", soundIcon='SpeechOff', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('speech disabled'), soundIcon='SpeechOff', interrupt=True) self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'))) if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].presentText("speech enabled", soundIcon='SpeechOn', interrupt=True) + self.env['runtime']['outputManager'].presentText(_('speech enabled'), soundIcon='SpeechOn', interrupt=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/toggle_tutorial_mode.py b/src/fenrir/commands/commands/toggle_tutorial_mode.py index e5ad15c8..d54122f9 100644 --- a/src/fenrir/commands/commands/toggle_tutorial_mode.py +++ b/src/fenrir/commands/commands/toggle_tutorial_mode.py @@ -15,10 +15,10 @@ class command(): pass def getDescription(self): self.env['generalInformation']['tutorialMode'] = False - return 'You are leving the tutorial mode. Press that shortcut again to enter the tutorial mode again.' + return _('You are leaving the tutorial mode. Press that shortcut again to enter the tutorial mode again.') def run(self): - text = 'you entered the tutorial mode. In that mode the commands are not executed. but you get a description of what the shortcut does. To leve the tutorial mode, press that shortcut again.' + text = _('you entered the tutorial mode. In that mode the commands are not executed. but you get a description of what the shortcut does. To leave the tutorial mode, press that shortcut again.') self.env['runtime']['outputManager'].presentText(text, interrupt=True) self.env['generalInformation']['tutorialMode'] = True