Skip to content

Commit

Permalink
* In keyboard help for emulated system keyboard keys, the translated …
Browse files Browse the repository at this point in the history
…version of a key is now spoken instead of the raw, untranslated version

* Also, the script name for emulated system keyboard keys is now localized

Both changes are based on a new simple function in keyLabels in which you insert a raw key combination string, which is than converted to a localised key combination identifier. (Re nvaccess#6212)
  • Loading branch information
Leonard de Ruijter committed Aug 16, 2016
1 parent f5ade27 commit c8fddef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion source/inputCore.py
Expand Up @@ -28,6 +28,7 @@
import globalVars
import languageHandler
import controlTypes
import keyLabels

#: Script category for emulated keyboard keys.
# Translators: The name of a category of NVDA commands.
Expand Down Expand Up @@ -613,7 +614,7 @@ def addGlobalMap(self, gmap):
def makeKbEmuScriptInfo(self, cls, scriptName):
info = AllGesturesScriptInfo(cls, scriptName)
info.category = SCRCAT_KBEMU
info.displayName = scriptName[3:]
info.displayName = keyLabels._getKeyCombinationLabel(scriptName[3:])
return info

def makeNormalScriptInfo(self, cls, scriptName, script):
Expand Down
3 changes: 3 additions & 0 deletions source/keyLabels.py
Expand Up @@ -162,3 +162,6 @@
# Translators: This is the name of a key on the keyboard.
'tab': pgettext("keyLabel", "tab"),
}

def _getKeyCombinationLabel(keyCombination):
return "+".join(localizedKeyLabels[key.lower()] for key in keyCombination.split("+"))
3 changes: 2 additions & 1 deletion source/scriptHandler.py
Expand Up @@ -17,6 +17,7 @@
import inputCore
import globalPluginHandler
import braille
import keyLabels

_numScriptsQueued=0 #Number of scripts that are queued to be executed
#: Number of scripts that send their gestures on that are queued to be executed or are currently being executed.
Expand All @@ -35,7 +36,7 @@ def _makeKbEmulateScript(scriptName):
# __name__ must be str; i.e. can't be unicode.
scriptName = scriptName.encode("mbcs")
func.__name__ = "script_%s" % scriptName
func.__doc__ = _("Emulates pressing %s on the system keyboard") % keyName
func.__doc__ = _("Emulates pressing %s on the system keyboard") % keyLabels._getKeyCombinationLabel(keyName)
return func

def _getObjScript(obj, gesture, globalMapScripts):
Expand Down

0 comments on commit c8fddef

Please sign in to comment.