Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions ource
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/source/speech/speech.py b/source/speech/speech.py
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
index 07bcc675d..cb86f19f1 100644
--- a/source/speech/speech.py
+++ b/source/speech/speech.py
@@ -1883,10 +1883,18 @@ def getPropertiesSpeech( # noqa: C901
rowCount=propertyValues.get('rowCount',0)
columnCount=propertyValues.get('columnCount',0)
if rowCount and columnCount:
- # Translators: Sub-part of the compound string to speak number of columns and rows in a table
- rowCountTranslation: str = _("{rowCount} rows").format(rowCount=rowCount)
- # Translators: Sub-part of the compound string to speak number of columns and rows in a table
- colCountTranslation: str = _("{columnCount} columns").format(columnCount=columnCount)
+ rowCountTranslation: str = ngettext(
+ # Translators: Sub-part of the compound string to speak number of columns and rows in a table
+ "{rowCount} row",
+ "{rowCount} rows",
+ rowCount,
+ ).format(rowCount=rowCount)
+ colCountTranslation: str = ngettext(
+ # Translators: Sub-part of the compound string to speak number of columns and rows in a table
+ "{columnCount} column",
+ "{columnCount} columns",
+ columnCount,
+ ).format(columnCount=columnCount)
# Translators: Main part of the compound string to speak number of columns and rows in a table
# Example output: "with 3 rows and 2 columns"
# In this example {rowCountTranslation} will be replaced by "3 rows" and {colCountTranslation} by
@@ -2791,12 +2799,21 @@ def getTableInfoSpeech(
newTable=False
textList=[]
if newTable:
- # Translators: Sub-part of the compound string to report a table
columnCount=tableInfo.get("column-count",0)
# Translators: Sub-part of the compound string to report a table
rowCount=tableInfo.get("row-count",0)
- columnCountText = _("{columnCount} columns").format(columnCount=columnCount)
- rowCountText = _("{rowCount} rows").format(rowCount=rowCount)
+ columnCountText = ngettext(
+ # Translators: Sub-part of the compound string to report a table
+ "{columnCount} column",
+ "{columnCount} columns",
+ columnCount,
+ ).format(columnCount=columnCount)
+ rowCountText = ngettext(
+ # Translators: Sub-part of the compound string to report a table
+ "{rowCount} rows",
+ "{rowCount} rows",
+ rowCount,
+ ).format(rowCount=rowCount)
# Translators: Main part of the compound string to report a table
# Example output: table with 3 columns and 5 rows
# {columnCountText} is replaced by "3 columns" and {rowCountText} by "5 rows"
Expand Down
3 changes: 2 additions & 1 deletion source/NVDAObjects/IAccessible/sysTreeView32.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def event_stateChange(self):
announceContains = self is api.getFocusObject() and controlTypes.State.EXPANDED in self.states and controlTypes.State.EXPANDED not in getattr(self,'_speakObjectPropertiesCache',{}).get('states',frozenset())
super(TreeViewItem,self).event_stateChange()
if announceContains:
speech.speakMessage(_("%s items")%self.childCount)
# Translators: a message reported when opening when expanding a node in a tree view.
speech.speakMessage(ngettext("%s item", "%s items", self.childCount) % self.childCount)

class BrokenCommctrl5Item(IAccessible):
"""Handle broken CommCtrl v5 SysTreeView32 items in 64 bit applications.
Expand Down
21 changes: 11 additions & 10 deletions source/NVDAObjects/UIA/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,13 @@ def script_showCellAppearanceInfo(self, gesture):
infoList.append(tmpl.format(self.cellSize))

if self.rotation is not None:
tmpl = pgettext(
infoList.append(npgettext(
"excel-UIA",
# Translators: The rotation in degrees of an Excel cell
"Rotation: {0} degrees"
)
infoList.append(tmpl.format(self.rotation))
"Rotation: {0} degree",
"Rotation: {0} degrees",
self.rotation,
).format(self.rotation))

if self.outlineColor is not None:
tmpl = pgettext(
Expand Down Expand Up @@ -520,12 +521,12 @@ def script_reportComment(self, gesture):
author=author
)
else:
# Translators: a comment on a cell in Microsoft excel.
text = _("Comment thread: {comment} by {author} with {numReplies} replies").format(
comment=comment,
author=author,
numReplies=numReplies
)
text = ngettext(
# Translators: a comment on a cell in Microsoft excel.
"Comment thread: {comment} by {author} with {numReplies} reply",
"Comment thread: {comment} by {author} with {numReplies} replies",
numReplies,
).format(comment=comment, author=author, numReplies=numReplies)
ui.message(text)
else:
# Translators: A message in Excel when there is no comment thread
Expand Down
8 changes: 6 additions & 2 deletions source/NVDAObjects/window/_msOfficeChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,12 @@ def _get_description(self):
# Translators: Indicates that there is 1 series in a chart.
seriesValueString = _( "There is 1 series in this chart" )
else:
Comment thread
seanbudd marked this conversation as resolved.
Resolved
# Translators: Indicates the number of series in a chart where there are multiple series.
seriesValueString = _( "There are total %d series in this chart" ) %(count)
seriesValueString = ngettext(
# Translators: Indicates the number of series in a chart where there are multiple series.
"There is total %d series in this chart",
"There are total %d series in this chart",
Comment thread
seanbudd marked this conversation as resolved.
Resolved
count,
) % count
for i in range(1, count+1):
# Translators: Specifies the number and name of a series when listing series in a chart.
seriesValueString += ", " + _("series {number} {name}").format(number=i, name=self.officeChartObject.SeriesCollection(i).Name)
Expand Down
42 changes: 31 additions & 11 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,30 +1535,50 @@ def getLocalizedMeasurementTextForPointSize(self,offset):
useCharacterUnit=options.useCharacterUnit
if useCharacterUnit:
offset=offset/self.WinwordSelectionObject.font.size
# Translators: a measurement in Microsoft Word
return _("{offset:.3g} characters").format(offset=offset)
return ngettext(
# Translators: a measurement in Microsoft Word
"{offset:.3g} character",
"{offset:.3g} characters",
offset,
).format(offset=offset)
else:
unit=options.measurementUnit
if unit==wdInches:
offset=offset/72.0
# Translators: a measurement in Microsoft Word
return _("{offset:.3g} inches").format(offset=offset)
return ngettext(
# Translators: a measurement in Microsoft Word
"{offset:.3g} inch",
"{offset:.3g} inches",
offset,
).format(offset=offset)
elif unit==wdCentimeters:
offset=offset/28.35
# Translators: a measurement in Microsoft Word
return _("{offset:.3g} centimeters").format(offset=offset)
return ngettext(
# Translators: a measurement in Microsoft Word
"{offset:.3g} centimeter",
"{offset:.3g} centimeters",
offset,
).format(offset=offset)
elif unit==wdMillimeters:
offset=offset/2.835
# Translators: a measurement in Microsoft Word
return _("{offset:.3g} millimeters").format(offset=offset)
return ngettext(
# Translators: a measurement in Microsoft Word
"{offset:.3g} millimeter",
"{offset:.3g} millimeters",
offset,
).format(offset=offset)
elif unit==wdPoints:
# Translators: a measurement in Microsoft Word (points)
return _("{offset:.3g} pt").format(offset=offset)
elif unit==wdPicas:
offset=offset/12.0
# Translators: a measurement in Microsoft Word
# See http://support.microsoft.com/kb/76388 for details.
return _("{offset:.3g} picas").format(offset=offset)
return ngettext(
# Translators: a measurement in Microsoft Word
# See http://support.microsoft.com/kb/76388 for details.
"{offset:.3g} pica",
"{offset:.3g} picas",
offset,
).format(offset=offset)

def script_changeLineSpacing(self,gesture):
if not self.WinwordSelectionObject:
Expand Down
136 changes: 104 additions & 32 deletions source/appModules/powerpnt.py
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -587,38 +587,70 @@ def _getOverlapText(self):
if overlapsOtherLeftBy>0:
total=False
if otherIsBehind:
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
textList.append(_("covers left of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherLeftBy))
textList.append(ngettext(
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
"covers left of {otherShape} by {distance:.3g} point",
"covers left of {otherShape} by {distance:.3g} points",
overlapsOtherLeftBy,
).format(otherShape=otherLabel, distance=overlapsOtherLeftBy))
else:
# Translators: A message when a shape is behind another shape on a powerpoint slide
textList.append(_("behind left of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherLeftBy))
textList.append(ngettext(
# Translators: A message when a shape is behind another shape on a powerpoint slide
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
"behind left of {otherShape} by {distance:.3g} point",
"behind left of {otherShape} by {distance:.3g} point",
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
overlapsOtherLeftBy,
).format(otherShape=otherLabel, distance=overlapsOtherLeftBy))
overlapsOtherTopBy=otherInfo['overlapsOtherTopBy']
if overlapsOtherTopBy>0:
total=False
if otherIsBehind:
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
textList.append(_("covers top of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherTopBy))
textList.append(ngettext(
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
"covers top of {otherShape} by {distance:.3g} point",
"covers top of {otherShape} by {distance:.3g} points",
overlapsOtherTopBy,
).format(otherShape=otherLabel, distance=overlapsOtherTopBy))
else:
# Translators: A message when a shape is behind another shape on a powerpoint slide
textList.append(_("behind top of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherTopBy))
textList.append(ngettext(
# Translators: A message when a shape is behind another shape on a powerpoint slide
"behind top of {otherShape} by {distance:.3g} point",
"behind top of {otherShape} by {distance:.3g} points",
overlapsOtherTopBy,
).format(otherShape=otherLabel, distance=overlapsOtherTopBy))
overlapsOtherRightBy=otherInfo['overlapsOtherRightBy']
if overlapsOtherRightBy>0:
total=False
if otherIsBehind:
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
textList.append(_("covers right of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherRightBy))
textList.append(ngettext(
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
"covers right of {otherShape} by {distance:.3g} point",
"covers right of {otherShape} by {distance:.3g} points",
overlapsOtherRightBy,
).format(otherShape=otherLabel, distance=overlapsOtherRightBy))
else:
# Translators: A message when a shape is behind another shape on a powerpoint slide
textList.append(_("behind right of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherRightBy))
textList.append(ngettext(
# Translators: A message when a shape is behind another shape on a powerpoint slide
"behind right of {otherShape} by {distance:.3g} point",
"behind right of {otherShape} by {distance:.3g} points",
overlapsOtherRightBy,
).format(otherShape=otherLabel, distance=overlapsOtherRightBy))
overlapsOtherBottomBy=otherInfo['overlapsOtherBottomBy']
if overlapsOtherBottomBy>0:
total=False
if otherIsBehind:
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
textList.append(_("covers bottom of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherBottomBy))
textList.append(ngettext(
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
"covers bottom of {otherShape} by {distance:.3g} point",
"covers bottom of {otherShape} by {distance:.3g} points",
overlapsOtherBottomBy,
).format(otherShape=otherLabel, distance=overlapsOtherBottomBy))
else:
# Translators: A message when a shape is behind another shape on a powerpoint slide
textList.append(_("behind bottom of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherBottomBy))
textList.append(ngettext(
# Translators: A message when a shape is behind another shape on a powerpoint slide
"behind bottom of {otherShape} by {distance:.3g} point",
"behind bottom of {otherShape} by {distance:.3g} points",
overlapsOtherBottomBy,
).format(otherShape=otherLabel, distance=overlapsOtherBottomBy))
if total:
if otherIsBehind:
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
Expand All @@ -644,32 +676,72 @@ def _getShapeLocationText(self,left=False,top=False,right=False,bottom=False):
onSlideList=[]
if left:
if leftDistance>=0:
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's left edge to the slide's left edge
onSlideList.append(_("{distance:.3g} points from left slide edge").format(distance=leftDistance))
onSlideList.append(ngettext(
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
# left edge to the slide's left edge
"{distance:.3g} point from left slide edge",
"{distance:.3g} points from left slide edge",
leftDistance,
).format(distance=leftDistance))
else:
# Translators: For a shape too far off the left edge of a Powerpoint Slide, this is the distance in points from the shape's left edge (off the slide) to the slide's left edge (where the slide starts)
offSlideList.append(_("Off left slide edge by {distance:.3g} points").format(distance=0-leftDistance))
offSlideList.append(ngettext(
# Translators: For a shape too far off the left edge of a Powerpoint Slide, this is the distance in
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
# points from the shape's left edge (off the slide) to the slide's left edge (where the slide starts)
"Off left slide edge by {distance:.3g} point",
"Off left slide edge by {distance:.3g} points",
-leftDistance,
).format(distance=-leftDistance))
if top:
if topDistance>=0:
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's top edge to the slide's top edge
onSlideList.append(_("{distance:.3g} points from top slide edge").format(distance=topDistance))
onSlideList.append(ngettext(
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
# top edge to the slide's top edge
"{distance:.3g} point from top slide edge",
"{distance:.3g} points from top slide edge",
topDistance,
).format(distance=topDistance))
else:
# Translators: For a shape too far off the top edge of a Powerpoint Slide, this is the distance in points from the shape's top edge (off the slide) to the slide's top edge (where the slide starts)
offSlideList.append(_("Off top slide edge by {distance:.3g} points").format(distance=0-topDistance))
offSlideList.append(ngettext(
# Translators: For a shape too far off the top edge of a Powerpoint Slide, this is the distance in
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
# points from the shape's top edge (off the slide) to the slide's top edge (where the slide starts)
"Off top slide edge by {distance:.3g} point",
"Off top slide edge by {distance:.3g} points",
-topDistance,
).format(distance=-topDistance))
if right:
if rightDistance>=0:
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's right edge to the slide's right edge
onSlideList.append(_("{distance:.3g} points from right slide edge").format(distance=rightDistance))
onSlideList.append(ngettext(
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
# right edge to the slide's right edge
"{distance:.3g} point from right slide edge",
"{distance:.3g} points from right slide edge",
rightDistance,
).format(distance=rightDistance))
else:
# Translators: For a shape too far off the right edge of a Powerpoint Slide, this is the distance in points from the shape's right edge (off the slide) to the slide's right edge (where the slide starts)
offSlideList.append(_("Off right slide edge by {distance:.3g} points").format(distance=0-rightDistance))
offSlideList.append(ngettext(
# Translators: For a shape too far off the right edge of a Powerpoint Slide, this is the distance in
# points from the shape's right edge (off the slide) to the slide's right edge (where the slide starts)
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
"Off right slide edge by {distance:.3g} point",
"Off right slide edge by {distance:.3g} points",
-rightDistance,
).format(distance=-rightDistance))
if bottom:
if bottomDistance>=0:
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's bottom edge to the slide's bottom edge
onSlideList.append(_("{distance:.3g} points from bottom slide edge").format(distance=bottomDistance))
onSlideList.append(ngettext(
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
# bottom edge to the slide's bottom edge
"{distance:.3g} point from bottom slide edge",
"{distance:.3g} points from bottom slide edge",
bottomDistance,
).format(distance=bottomDistance))
else:
# Translators: For a shape too far off the bottom edge of a Powerpoint Slide, this is the distance in points from the shape's bottom edge (off the slide) to the slide's bottom edge (where the slide starts)
offSlideList.append(_("Off bottom slide edge by {distance:.3g} points").format(distance=0-bottomDistance))
offSlideList.append(ngettext(
# Translators: For a shape too far off the bottom edge of a Powerpoint Slide, this is the distance in
Comment thread
CyrilleB79 marked this conversation as resolved.
Resolved
# points from the shape's bottom edge (off the slide) to the slide's bottom edge (where the slide starts)
"Off bottom slide edge by {distance:.3g} point",
"Off bottom slide edge by {distance:.3g} points",
-bottomDistance
).format(distance=-bottomDistance))
return ", ".join(offSlideList+onSlideList)

def _get_locationText(self):
Expand Down
16 changes: 12 additions & 4 deletions source/appModules/soffice.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,20 @@ def getDistanceTextForTwips(twips):
converted to the local measurement unit."""
if languageHandler.useImperialMeasurements():
val = twips / 1440.0
# Translators: a measurement in inches
valText = _("{val:.2f} inches").format(val=val)
valText = ngettext(
# Translators: a measurement in inches
"{val:.2f} inch",
"{val:.2f} inches",
val,
).format(val=val)
else:
val = twips * 0.0017638889
# Translators: a measurement in centimetres
valText = _("{val:.2f} centimetres").format(val=val)
valText = ngettext(
# Translators: a measurement in centimetres
"{val:.2f} centimetre",
"{val:.2f} centimetres",
val,
).format(val=val)
return valText


Expand Down
Loading