Skip to content

Commit 13dce07

Browse files
authored
Merge 009744a into 021c13d
2 parents 021c13d + 009744a commit 13dce07

14 files changed

Lines changed: 235 additions & 98 deletions

File tree

source/NVDAObjects/IAccessible/sysTreeView32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def event_stateChange(self):
182182
announceContains = self is api.getFocusObject() and controlTypes.State.EXPANDED in self.states and controlTypes.State.EXPANDED not in getattr(self,'_speakObjectPropertiesCache',{}).get('states',frozenset())
183183
super(TreeViewItem,self).event_stateChange()
184184
if announceContains:
185-
speech.speakMessage(_("%s items")%self.childCount)
185+
speech.speakMessage(ngettext("%s item", "%s items", self.childCount) % self.childCount)
186186

187187
class BrokenCommctrl5Item(IAccessible):
188188
"""Handle broken CommCtrl v5 SysTreeView32 items in 64 bit applications.

source/NVDAObjects/UIA/excel.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,13 @@ def script_showCellAppearanceInfo(self, gesture):
215215
infoList.append(tmpl.format(self.cellSize))
216216

217217
if self.rotation is not None:
218-
tmpl = pgettext(
218+
infoList.append(npgettext(
219219
"excel-UIA",
220220
# Translators: The rotation in degrees of an Excel cell
221-
"Rotation: {0} degrees"
222-
)
223-
infoList.append(tmpl.format(self.rotation))
221+
"Rotation: {0} degree",
222+
"Rotation: {0} degrees",
223+
self.rotation,
224+
).format(self.rotation))
224225

225226
if self.outlineColor is not None:
226227
tmpl = pgettext(
@@ -520,12 +521,12 @@ def script_reportComment(self, gesture):
520521
author=author
521522
)
522523
else:
523-
# Translators: a comment on a cell in Microsoft excel.
524-
text = _("Comment thread: {comment} by {author} with {numReplies} replies").format(
525-
comment=comment,
526-
author=author,
527-
numReplies=numReplies
528-
)
524+
text = ngettext(
525+
# Translators: a comment on a cell in Microsoft excel.
526+
"Comment thread: {comment} by {author} with {numReplies} reply",
527+
"Comment thread: {comment} by {author} with {numReplies} replies",
528+
numReplies,
529+
).format(comment=comment, author=author, numReplies=numReplies)
529530
ui.message(text)
530531
else:
531532
# Translators: A message in Excel when there is no comment thread

source/NVDAObjects/window/_msOfficeChart.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,11 @@ def _get_description(self):
562562
seriesValueString = _( "There is 1 series in this chart" )
563563
else:
564564
# Translators: Indicates the number of series in a chart where there are multiple series.
565-
seriesValueString = _( "There are total %d series in this chart" ) %(count)
565+
seriesValueString = ngettext(
566+
"There is total %d series in this chart",
567+
"There are total %d series in this chart",
568+
count,
569+
) % count
566570
for i in range(1, count+1):
567571
# Translators: Specifies the number and name of a series when listing series in a chart.
568572
seriesValueString += ", " + _("series {number} {name}").format(number=i, name=self.officeChartObject.SeriesCollection(i).Name)

source/NVDAObjects/window/winword.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,30 +1535,50 @@ def getLocalizedMeasurementTextForPointSize(self,offset):
15351535
useCharacterUnit=options.useCharacterUnit
15361536
if useCharacterUnit:
15371537
offset=offset/self.WinwordSelectionObject.font.size
1538-
# Translators: a measurement in Microsoft Word
1539-
return _("{offset:.3g} characters").format(offset=offset)
1538+
return ngettext(
1539+
# Translators: a measurement in Microsoft Word
1540+
"{offset:.3g} character",
1541+
"{offset:.3g} characters",
1542+
offset,
1543+
).format(offset=offset)
15401544
else:
15411545
unit=options.measurementUnit
15421546
if unit==wdInches:
15431547
offset=offset/72.0
1544-
# Translators: a measurement in Microsoft Word
1545-
return _("{offset:.3g} inches").format(offset=offset)
1548+
return ngettext(
1549+
# Translators: a measurement in Microsoft Word
1550+
"{offset:.3g} inch",
1551+
"{offset:.3g} inches",
1552+
offset,
1553+
).format(offset=offset)
15461554
elif unit==wdCentimeters:
15471555
offset=offset/28.35
1548-
# Translators: a measurement in Microsoft Word
1549-
return _("{offset:.3g} centimeters").format(offset=offset)
1556+
return ngettext(
1557+
# Translators: a measurement in Microsoft Word
1558+
"{offset:.3g} centimeter",
1559+
"{offset:.3g} centimeters",
1560+
offset,
1561+
).format(offset=offset)
15501562
elif unit==wdMillimeters:
15511563
offset=offset/2.835
1552-
# Translators: a measurement in Microsoft Word
1553-
return _("{offset:.3g} millimeters").format(offset=offset)
1564+
return ngettext(
1565+
# Translators: a measurement in Microsoft Word
1566+
"{offset:.3g} millimeter",
1567+
"{offset:.3g} millimeters",
1568+
offset,
1569+
).format(offset=offset)
15541570
elif unit==wdPoints:
15551571
# Translators: a measurement in Microsoft Word (points)
15561572
return _("{offset:.3g} pt").format(offset=offset)
15571573
elif unit==wdPicas:
15581574
offset=offset/12.0
1559-
# Translators: a measurement in Microsoft Word
1560-
# See http://support.microsoft.com/kb/76388 for details.
1561-
return _("{offset:.3g} picas").format(offset=offset)
1575+
return ngettext(
1576+
# Translators: a measurement in Microsoft Word
1577+
# See http://support.microsoft.com/kb/76388 for details.
1578+
"{offset:.3g} pica",
1579+
"{offset:.3g} picas",
1580+
offset,
1581+
).format(offset=offset)
15621582

15631583
def script_changeLineSpacing(self,gesture):
15641584
if not self.WinwordSelectionObject:

source/appModules/powerpnt.py

Lines changed: 104 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -587,38 +587,70 @@ def _getOverlapText(self):
587587
if overlapsOtherLeftBy>0:
588588
total=False
589589
if otherIsBehind:
590-
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
591-
textList.append(_("covers left of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherLeftBy))
590+
textList.append(ngettext(
591+
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
592+
"covers left of {otherShape} by {distance:.3g} point",
593+
"covers left of {otherShape} by {distance:.3g} points",
594+
overlapsOtherLeftBy,
595+
).format(otherShape=otherLabel, distance=overlapsOtherLeftBy))
592596
else:
593-
# Translators: A message when a shape is behind another shape on a powerpoint slide
594-
textList.append(_("behind left of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherLeftBy))
597+
textList.append(ngettext(
598+
# Translators: A message when a shape is behind another shape on a powerpoint slide
599+
"behind left of {otherShape} by {distance:.3g} point",
600+
"behind left of {otherShape} by {distance:.3g} point",
601+
overlapsOtherLeftBy,
602+
).format(otherShape=otherLabel, distance=overlapsOtherLeftBy))
595603
overlapsOtherTopBy=otherInfo['overlapsOtherTopBy']
596604
if overlapsOtherTopBy>0:
597605
total=False
598606
if otherIsBehind:
599-
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
600-
textList.append(_("covers top of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherTopBy))
607+
textList.append(ngettext(
608+
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
609+
"covers top of {otherShape} by {distance:.3g} point",
610+
"covers top of {otherShape} by {distance:.3g} points",
611+
overlapsOtherTopBy,
612+
).format(otherShape=otherLabel, distance=overlapsOtherTopBy))
601613
else:
602-
# Translators: A message when a shape is behind another shape on a powerpoint slide
603-
textList.append(_("behind top of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherTopBy))
614+
textList.append(ngettext(
615+
# Translators: A message when a shape is behind another shape on a powerpoint slide
616+
"behind top of {otherShape} by {distance:.3g} point",
617+
"behind top of {otherShape} by {distance:.3g} points",
618+
overlapsOtherTopBy,
619+
).format(otherShape=otherLabel, distance=overlapsOtherTopBy))
604620
overlapsOtherRightBy=otherInfo['overlapsOtherRightBy']
605621
if overlapsOtherRightBy>0:
606622
total=False
607623
if otherIsBehind:
608-
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
609-
textList.append(_("covers right of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherRightBy))
624+
textList.append(ngettext(
625+
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
626+
"covers right of {otherShape} by {distance:.3g} point",
627+
"covers right of {otherShape} by {distance:.3g} points",
628+
overlapsOtherRightBy,
629+
).format(otherShape=otherLabel, distance=overlapsOtherRightBy))
610630
else:
611-
# Translators: A message when a shape is behind another shape on a powerpoint slide
612-
textList.append(_("behind right of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherRightBy))
631+
textList.append(ngettext(
632+
# Translators: A message when a shape is behind another shape on a powerpoint slide
633+
"behind right of {otherShape} by {distance:.3g} point",
634+
"behind right of {otherShape} by {distance:.3g} points",
635+
overlapsOtherRightBy,
636+
).format(otherShape=otherLabel, distance=overlapsOtherRightBy))
613637
overlapsOtherBottomBy=otherInfo['overlapsOtherBottomBy']
614638
if overlapsOtherBottomBy>0:
615639
total=False
616640
if otherIsBehind:
617-
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
618-
textList.append(_("covers bottom of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherBottomBy))
641+
textList.append(ngettext(
642+
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
643+
"covers bottom of {otherShape} by {distance:.3g} point",
644+
"covers bottom of {otherShape} by {distance:.3g} points",
645+
overlapsOtherBottomBy,
646+
).format(otherShape=otherLabel, distance=overlapsOtherBottomBy))
619647
else:
620-
# Translators: A message when a shape is behind another shape on a powerpoint slide
621-
textList.append(_("behind bottom of {otherShape} by {distance:.3g} points").format(otherShape=otherLabel,distance=overlapsOtherBottomBy))
648+
textList.append(ngettext(
649+
# Translators: A message when a shape is behind another shape on a powerpoint slide
650+
"behind bottom of {otherShape} by {distance:.3g} point",
651+
"behind bottom of {otherShape} by {distance:.3g} points",
652+
overlapsOtherBottomBy,
653+
).format(otherShape=otherLabel, distance=overlapsOtherBottomBy))
622654
if total:
623655
if otherIsBehind:
624656
# Translators: A message when a shape is infront of another shape on a Powerpoint slide
@@ -644,32 +676,72 @@ def _getShapeLocationText(self,left=False,top=False,right=False,bottom=False):
644676
onSlideList=[]
645677
if left:
646678
if leftDistance>=0:
647-
# 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
648-
onSlideList.append(_("{distance:.3g} points from left slide edge").format(distance=leftDistance))
679+
onSlideList.append(ngettext(
680+
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
681+
# left edge to the slide's left edge
682+
"{distance:.3g} point from left slide edge",
683+
"{distance:.3g} points from left slide edge",
684+
leftDistance,
685+
).format(distance=leftDistance))
649686
else:
650-
# 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)
651-
offSlideList.append(_("Off left slide edge by {distance:.3g} points").format(distance=0-leftDistance))
687+
offSlideList.append(ngettext(
688+
# Translators: For a shape too far off the left edge of a Powerpoint Slide, this is the distance in
689+
# points from the shape's left edge (off the slide) to the slide's left edge (where the slide starts)
690+
"Off left slide edge by {distance:.3g} point",
691+
"Off left slide edge by {distance:.3g} points",
692+
-leftDistance,
693+
).format(distance=-leftDistance))
652694
if top:
653695
if topDistance>=0:
654-
# 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
655-
onSlideList.append(_("{distance:.3g} points from top slide edge").format(distance=topDistance))
696+
onSlideList.append(ngettext(
697+
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
698+
# top edge to the slide's top edge
699+
"{distance:.3g} point from top slide edge",
700+
"{distance:.3g} points from top slide edge",
701+
topDistance,
702+
).format(distance=topDistance))
656703
else:
657-
# 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)
658-
offSlideList.append(_("Off top slide edge by {distance:.3g} points").format(distance=0-topDistance))
704+
offSlideList.append(ngettext(
705+
# Translators: For a shape too far off the top edge of a Powerpoint Slide, this is the distance in
706+
# points from the shape's top edge (off the slide) to the slide's top edge (where the slide starts)
707+
"Off top slide edge by {distance:.3g} point",
708+
"Off top slide edge by {distance:.3g} points",
709+
-topDistance,
710+
).format(distance=-topDistance))
659711
if right:
660712
if rightDistance>=0:
661-
# 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
662-
onSlideList.append(_("{distance:.3g} points from right slide edge").format(distance=rightDistance))
713+
onSlideList.append(ngettext(
714+
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
715+
# right edge to the slide's right edge
716+
"{distance:.3g} point from right slide edge",
717+
"{distance:.3g} points from right slide edge",
718+
rightDistance,
719+
).format(distance=rightDistance))
663720
else:
664-
# 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)
665-
offSlideList.append(_("Off right slide edge by {distance:.3g} points").format(distance=0-rightDistance))
721+
offSlideList.append(ngettext(
722+
# Translators: For a shape too far off the right edge of a Powerpoint Slide, this is the distance in
723+
# points from the shape's right edge (off the slide) to the slide's right edge (where the slide starts)
724+
"Off right slide edge by {distance:.3g} point",
725+
"Off right slide edge by {distance:.3g} points",
726+
-rightDistance,
727+
).format(distance=-rightDistance))
666728
if bottom:
667729
if bottomDistance>=0:
668-
# 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
669-
onSlideList.append(_("{distance:.3g} points from bottom slide edge").format(distance=bottomDistance))
730+
onSlideList.append(ngettext(
731+
# Translators: For a shape within a Powerpoint Slide, this is the distance in points from the shape's
732+
# bottom edge to the slide's bottom edge
733+
"{distance:.3g} point from bottom slide edge",
734+
"{distance:.3g} points from bottom slide edge",
735+
bottomDistance,
736+
).format(distance=bottomDistance))
670737
else:
671-
# 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)
672-
offSlideList.append(_("Off bottom slide edge by {distance:.3g} points").format(distance=0-bottomDistance))
738+
offSlideList.append(ngettext(
739+
# Translators: For a shape too far off the bottom edge of a Powerpoint Slide, this is the distance in
740+
# points from the shape's bottom edge (off the slide) to the slide's bottom edge (where the slide starts)
741+
"Off bottom slide edge by {distance:.3g} point",
742+
"Off bottom slide edge by {distance:.3g} points",
743+
-bottomDistance
744+
).format(distance=-bottomDistance))
673745
return ", ".join(offSlideList+onSlideList)
674746

675747
def _get_locationText(self):

source/appModules/soffice.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,20 @@ def getDistanceTextForTwips(twips):
358358
converted to the local measurement unit."""
359359
if languageHandler.useImperialMeasurements():
360360
val = twips / 1440.0
361-
# Translators: a measurement in inches
362-
valText = _("{val:.2f} inches").format(val=val)
361+
valText = ngettext(
362+
# Translators: a measurement in inches
363+
"{val:.2f} inch",
364+
"{val:.2f} inches",
365+
val,
366+
).format(val=val)
363367
else:
364368
val = twips * 0.0017638889
365-
# Translators: a measurement in centimetres
366-
valText = _("{val:.2f} centimetres").format(val=val)
369+
valText = ngettext(
370+
# Translators: a measurement in centimetres
371+
"{val:.2f} centimetre",
372+
"{val:.2f} centimetres",
373+
val,
374+
).format(val=val)
367375
return valText
368376

369377

source/globalCommands.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,7 +3449,8 @@ def script_reportClipboardText(self,gesture):
34493449
# Translators: Presented when there is no text on the clipboard.
34503450
ui.message(_("There is no text on the clipboard"))
34513451
return
3452-
if len(text) < 1024:
3452+
textLength = len(text)
3453+
if textLength < 1024:
34533454
repeatCount = scriptHandler.getLastScriptRepeatCount()
34543455
if repeatCount == 0:
34553456
ui.message(text)
@@ -3458,7 +3459,11 @@ def script_reportClipboardText(self,gesture):
34583459
else:
34593460
# 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.
34603461
# Example output: The clipboard contains a large portion of text. It is 2300 characters long.
3461-
ui.message(_("The clipboard contains a large portion of text. It is %s characters long") % len(text))
3462+
ui.message(ngettext(
3463+
"The clipboard contains a large portion of text. It is %s character long",
3464+
"The clipboard contains a large portion of text. It is %s characters long",
3465+
textLength,
3466+
) % textLength)
34623467

34633468
@script(
34643469
description=_(

source/gui/addonStoreGui/controls/details.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ class AddonDetails(
3838
# Translators: Header (usually the add-on name) when no add-on is selected. In the add-on store dialog.
3939
_noAddonSelectedLabelText: str = pgettext("addonStore", "No add-on selected.")
4040

41-
# Translators: Header (usually the add-on name) when multiple add-ons are selected.
42-
# In the add-on store dialog.
43-
_multiAddonSelectedLabelText: str = pgettext("addonStore", "{num} add-ons selected.")
44-
4541
# Translators: Label for the text control containing a description of the selected add-on.
4642
# In the add-on store dialog.
4743
_descriptionLabelText: str = pgettext("addonStore", "Description:")
@@ -213,7 +209,14 @@ def _refresh(self):
213209
self.otherDetailsTextCtrl.SetValue("")
214210
if numSelectedAddons > 1:
215211
self.contentsPanel.Hide()
216-
self.updateAddonName(AddonDetails._multiAddonSelectedLabelText.format(num=numSelectedAddons))
212+
self.updateAddonName(npgettext(
213+
"addonStore",
214+
# Translators: Header (usually the add-on name) when multiple add-ons are selected.
215+
# In the add-on store dialog.
216+
"{num} add-on selected.",
217+
"{num} add-ons selected.",
218+
numSelectedAddons,
219+
).format(num=numSelectedAddons))
217220
elif not details:
218221
self.contentsPanel.Hide()
219222
if self._detailsVM._listVM._isLoading:

0 commit comments

Comments
 (0)