Repository: nvaccess/nvda

Issue:
Add a procedure to spell emojis
### Is your feature request related to a problem? Please describe.

Emojis can be announced as complete words, but spelling them is not supported.

### Describe the solution you'd like
When the review cursor is placed on an emoji, a gesture may open a dialog showing the words corresponding to the emoji description, the same announced by NVDA, so that they can be reviewed with speech or using a braille display, or copied.

### Describe alternatives you've considered

The description may be provided by pressing 2 or NVDA+. twice, but this could be a concern for people with mobility issues. 

### Additional context

Emoji descriptions is not shown in Speech Viewer, so this dialog could be especially useful. If this is marked as wontfix, we could try to include this feature in the Emoticons add-on, developed by @Christianlm and others.


Discussion:
CC @LeonardDeR

 

From: nvdaes <notifications@github.com> 
Sent: Friday, February 15, 2019 6:25 PM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [nvaccess/nvda] Add a procedure to spell emojis (#9286)

 


Is your feature request related to a problem? Please describe.


Emojis can be announced as complete words, but spelling them is not supported.


Describe the solution you'd like


When the review cursor is placed on an emoji, a gesture may open a dialog showing the words corresponding to the emoji description, the same announced by NVDA, so that they can be reviewed with speech or using a braille display, or copied.


Describe alternatives you've considered


The description may be provided by pressing 2 or NVDA+. twice, but this could be a concern for people with mobility issues.


Additional context


Emoji descriptions is not shown in Speech Viewer, so this dialog could be especially useful. If this is marked as wontfix, we could try to include this feature in the Emoticons add-on, developed by @Christianlm <https://github.com/Christianlm>  and others.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/9286> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkJtcLrkYzTXsLpWvGbSdKxrq3Fndks5vN2vggaJpZM4a-uyL> .


Thanks @@josephsl . About the dialog, ui.browseableMessage could also be used. Other alternative would be if symbols could be searched in the symbol dialog, to view the description, but this is not comfortable.
Also, we need to think if the dialog will show the description chosen by the user in customized symbols, or the provided by default, or if this should be configurable.

Other thought about this: This should be generalized for other symbols, not just emojis, for instance comma and so on.
One possible approach would be:

>info=api.getReviewPosition().copy()
info.expand(textInfos.UNIT_CHARACTER)
ui.browseableMessage(characterProcessing.processSpeechSymbol(locale, info.text))

The locale could be the NVDA's interface language. I have tested this in the Python console. To avoid that a browseable message is open for normal characters, we could check that info.isalpha and info.isspace is False.
If this can't be included in NVDA, I'm thinking about making it available in Emoticons add-ons. This is useful to know how emojis should be writen when they are expanded.


Resolving patch:
diff --git a/source/globalCommands.py b/source/globalCommands.py
--- a/source/globalCommands.py
+++ b/source/globalCommands.py
@@ -32,6 +32,7 @@
 import treeInterceptorHandler
 import browseMode
 import scriptHandler
+from scriptHandler import script
 import ui
 import braille
 import brailleInput
@@ -1188,6 +1189,42 @@ def script_review_endOfLine(self,gesture):
 	script_review_endOfLine.__doc__=_("Moves the review cursor to the last character of the line where it is situated in the current navigator object and speaks it")
 	script_review_endOfLine.category=SCRCAT_TEXTREVIEW
 
+	def _getCurrentLanguageForTextInfo(self, info):
+		curLanguage = None
+		if config.conf['speech']['autoLanguageSwitching']:
+			for field in info.getTextWithFields({}):
+				if isinstance(field, textInfos.FieldCommand) and field.command == "formatChange":
+					curLanguage = field.field.get('language')
+		if curLanguage is None:
+			curLanguage = speech.getCurrentLanguage()
+		return curLanguage
+
+	@script(
+		# Translators: Input help mode message for Review Current Symbol command.
+		description=_("Reports the symbol where the review cursor is positioned. Pressed twice, shows the symbol and the text used to speak it in browse mode"),
+		category=SCRCAT_TEXTREVIEW,
+	)
+	def script_review_currentSymbol(self,gesture):
+		info=api.getReviewPosition().copy()
+		info.expand(textInfos.UNIT_CHARACTER)
+		curLanguage = self._getCurrentLanguageForTextInfo(info)
+		text = info.text
+		expandedSymbol = characterProcessing.processSpeechSymbol(curLanguage, text)
+		if expandedSymbol == text:
+			# Translators: Reported when there is no replacement for the symbol at the position of the review cursor.
+			ui.message(_("No symbol replacement"))
+			return
+		repeats=scriptHandler.getLastScriptRepeatCount()
+		if repeats == 0:
+			ui.message(expandedSymbol)
+		else:
+			# Translators: Character and its replacement used from the "Review current Symbol" command. Example: "Character: ? Replacement: question"
+			message = _("Character: {}\nReplacement: {}").format(text, expandedSymbol)
+			languageDescription = languageHandler.getLanguageDescription(curLanguage)
+			# Translators: title for expanded symbol dialog. Example: "Expanded symbol (English)"
+			title = _("Expanded symbol ({})").format(languageDescription)
+			ui.browseableMessage(message, title)
+
 	def script_speechMode(self,gesture):
 		curMode=speech.speechMode
 		speech.speechMode=speech.speechMode_talk


Test patch: