Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 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
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
13 changes: 7 additions & 6 deletions source/NVDAObjects/window/_msOfficeChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,13 @@ def _get_description(self):
count = self.officeChartObject.SeriesCollection().count
text=""
if count>0:
if count == 1:
# Translators: Indicates that there is 1 series in a chart.
seriesValueString = _( "There is 1 series in this chart" )
else:
# 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.
"There is %d series in this chart",
"There are %d series in this chart",
count,
) % count
if count > 1:
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.
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.
Outdated
"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
"behind left of {otherShape} by {distance:.3g} point",
Comment thread
CyrilleB79 marked this conversation as resolved.
"behind left of {otherShape} by {distance:.3g} points",
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
# 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
# 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)
"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
# 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
14 changes: 10 additions & 4 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3449,16 +3449,22 @@ def script_reportClipboardText(self,gesture):
# Translators: Presented when there is no text on the clipboard.
ui.message(_("There is no text on the clipboard"))
return
if len(text) < 1024:
textLength = len(text)
if textLength < 1024:
repeatCount = scriptHandler.getLastScriptRepeatCount()
if repeatCount == 0:
ui.message(text)
else:
speech.speakSpelling(text, useCharacterDescriptions=repeatCount > 1)
else:
# Translators: If the number of characters on the clipboard is greater than about 1000, it reports this message and gives number of characters on the clipboard.
# Example output: The clipboard contains a large portion of text. It is 2300 characters long.
ui.message(_("The clipboard contains a large portion of text. It is %s characters long") % len(text))
ui.message(ngettext(
# Translators: If the number of characters on the clipboard is greater than about 1000, it reports this
# message and gives number of characters on the clipboard.
# Example output: The clipboard contains a large amount of text. It is 2300 characters long.
"The clipboard contains a large amount of text. It is %s character long",
"The clipboard contains a large amount of text. It is %s characters long",
textLength,
) % textLength)

@script(
description=_(
Expand Down
13 changes: 8 additions & 5 deletions source/gui/addonStoreGui/controls/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ class AddonDetails(
# Translators: Header (usually the add-on name) when no add-on is selected. In the add-on store dialog.
_noAddonSelectedLabelText: str = pgettext("addonStore", "No add-on selected.")

# Translators: Header (usually the add-on name) when multiple add-ons are selected.
# In the add-on store dialog.
_multiAddonSelectedLabelText: str = pgettext("addonStore", "{num} add-ons selected.")

# Translators: Label for the text control containing a description of the selected add-on.
# In the add-on store dialog.
_descriptionLabelText: str = pgettext("addonStore", "Description:")
Expand Down Expand Up @@ -213,7 +209,14 @@ def _refresh(self):
self.otherDetailsTextCtrl.SetValue("")
if numSelectedAddons > 1:
self.contentsPanel.Hide()
self.updateAddonName(AddonDetails._multiAddonSelectedLabelText.format(num=numSelectedAddons))
self.updateAddonName(npgettext(
"addonStore",
# Translators: Header (usually the add-on name) when multiple add-ons are selected.
# In the add-on store dialog.
"{num} add-on selected.",
"{num} add-ons selected.",
numSelectedAddons,
).format(num=numSelectedAddons))
elif not details:
self.contentsPanel.Hide()
if self._detailsVM._listVM._isLoading:
Expand Down
Loading