Repository: nvaccess/nvda

Issue:
Translation system not used for emulated system keyboard keys in some cases
In the following cases, the untranslated, raw version of a keyboard key is passed to the end user rather than the translated version:
1. When executing a gesture that emulates a system keyboard key in keyboard help. [I already have a fix or this](https://github.com/nvaccess/nvda/files/385584/0001-In-keyboard-help-for-emulated-system-keyboard-keys-t.txt).
2. When listing emulated system keyboard keys in the input gestures dialog.



Discussion:

Resolving patch:
diff --git a/source/inputCore.py b/source/inputCore.py
--- a/source/inputCore.py
+++ b/source/inputCore.py
@@ -2,7 +2,7 @@
 #A part of NonVisual Desktop Access (NVDA)
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
-#Copyright (C) 2010 James Teh <jamie@jantrid.net>
+#Copyright (C) 2010-2016 NV Access Limited, Babbage B.V.
 
 """Core framework for handling input from the user.
 Every piece of input from the user (e.g. a key press) is represented by an L{InputGesture}.
@@ -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.
@@ -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):
diff --git a/source/keyLabels.py b/source/keyLabels.py
--- a/source/keyLabels.py
+++ b/source/keyLabels.py
@@ -2,7 +2,7 @@
 #A part of NonVisual Desktop Access (NVDA)
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
-#Copyright (C) 2008-2010 James Teh <jamie@jantrid.net>, Aleksey Sadovoy <lex@onm.su>
+#Copyright (C) 2008-2016 NV Access Limited, Aleksey Sadovoy, Babbage B.v.
 
 localizedKeyLabels = {
 	# Translators: This is the name of the back key found on multimedia keyboards for controlling the web-browser.
@@ -162,3 +162,14 @@
 	# Translators: This is the name of a key on the keyboard.
 	'tab': pgettext("keyLabel", "tab"),
 }
+
+def getKeyCombinationLabel(keyCombination):
+	"""
+	Fetches a localized label for a combination of multiple keys.
+	@param keyCombination: The key combination identifier to get the localized label for, usually plus-separated key identifiers.
+	@type keyCombination: string
+	@returns: A localized key combination
+	@rtype: string
+	"""
+	keys = keyCombination.lower().split("+")
+	return "+".join(localizedKeyLabels.get(key, key) for key in keys)
diff --git a/source/scriptHandler.py b/source/scriptHandler.py
--- a/source/scriptHandler.py
+++ b/source/scriptHandler.py
@@ -1,6 +1,6 @@
 #scriptHandler.py
 #A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2006-2008 NVDA Contributors <http://www.nvda-project.org/>
+#Copyright (C) 2006-2016 NVDA Contributors <http://www.nvda-project.org/>
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
 
@@ -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.
@@ -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") % emuGesture.displayName
 	return func
 
 def _getObjScript(obj, gesture, globalMapScripts):


Test patch: