Skip to content

Commit

Permalink
Allow translators to specify row/column when reporting the end coordi…
Browse files Browse the repository at this point in the history
…nate of a merged cell (#14585)

For some translators (Chinese ones at least), in the case of merged cell it would be better to report "column 2 to column 3" instead of "column 2 to 3" as we do today.
Today, NVDA uses 2 translatable strings to report the coordinates of a merged cell:
• for rows: "row %s" and "through %s"
• for columns: "column %s" and and "through %s"

Description of user facing changes
Translators will now have two strings indicating the end coordinate of a merged cell, one for rows and one for columns.

Description of development approach
I just have used .format(...) with named parameters. Defining strings with two parameters named differently allows to create 2 translatable strings instead of only one. As a side effect, it's also better for translators to have named parameters rather than just %s which is not explicit.
Note: using pgettext was another option, but with named parameters, it didn't turn out to be necessary.
  • Loading branch information
CyrilleB79 authored Feb 1, 2023
1 parent ca4fcc7 commit 79ad4f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/speech/speech.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,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) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Babbage B.V., Bill Dengler,
# Copyright (C) 2006-2023 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Babbage B.V., Bill Dengler,
# Julien Cochuyt, Derek Riemer, Cyrille Bougot

"""High-level functions to speak information.
Expand Down Expand Up @@ -1755,7 +1755,7 @@ def getPropertiesSpeech( # noqa: C901
textList.append(rowNumberTranslation)
if rowSpan>1 and columnSpan<=1:
# Translators: Speaks the row span added to the current row number (example output: through 5).
rowSpanAddedTranslation: str = _("through %s") % (rowNumber + rowSpan - 1)
rowSpanAddedTranslation: str = _("through {endRow}").format(endRow=rowNumber + rowSpan - 1)
textList.append(rowSpanAddedTranslation)
_speechState.oldRowNumber = rowNumber
_speechState.oldRowSpan = rowSpan
Expand All @@ -1773,7 +1773,7 @@ def getPropertiesSpeech( # noqa: C901
textList.append(colNumberTranslation)
if columnSpan>1 and rowSpan<=1:
# Translators: Speaks the column span added to the current column number (example output: through 5).
colSpanAddedTranslation: str = _("through %s") % (columnNumber + columnSpan - 1)
colSpanAddedTranslation: str = _("through {endCol}").format(endCol=columnNumber + columnSpan - 1)
textList.append(colSpanAddedTranslation)
_speechState.oldColumnNumber = columnNumber
_speechState.oldColumnSpan = columnSpan
Expand Down

0 comments on commit 79ad4f0

Please sign in to comment.