|
1 | 1 | # A part of NonVisual Desktop Access (NVDA) |
2 | | -# Copyright (C) 2022-2023 NV Access Limited |
| 2 | +# Copyright (C) 2022-2023 NV Access Limited, Cyrille Bougot |
3 | 3 | # This file is covered by the GNU General Public License. |
4 | 4 | # See the file COPYING for more details. |
5 | 5 |
|
@@ -245,17 +245,38 @@ class _StatusFilterKey(DisplayStringEnum): |
245 | 245 |
|
246 | 246 | @property |
247 | 247 | def _displayStringLabels(self) -> Dict["_StatusFilterKey", str]: |
| 248 | + return {k: v.replace('&', '') for (k, v) in self._displayStringLabelsWithAccelerators.items()} |
| 249 | + |
| 250 | + @property |
| 251 | + def _displayStringLabelsWithAccelerators(self) -> Dict["_StatusFilterKey", str]: |
248 | 252 | return { |
249 | | - # Translators: A selection option to display installed add-ons in the add-on store |
250 | | - self.INSTALLED: pgettext("addonStore", "Installed add-ons"), |
251 | | - # Translators: A selection option to display updatable add-ons in the add-on store |
252 | | - self.UPDATE: pgettext("addonStore", "Updatable add-ons"), |
253 | | - # Translators: A selection option to display available add-ons in the add-on store |
254 | | - self.AVAILABLE: pgettext("addonStore", "Available add-ons"), |
255 | | - # Translators: A selection option to display incompatible add-ons in the add-on store |
256 | | - self.INCOMPATIBLE: pgettext("addonStore", "Installed incompatible add-ons"), |
| 253 | + # Translators: The label of a tab to display installed add-ons in the add-on store and the label of the |
| 254 | + # add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels) |
| 255 | + self.INSTALLED: pgettext("addonStore", "Installed &add-ons"), |
| 256 | + # Translators: The label of a tab to display updatable add-ons in the add-on store and the label of the |
| 257 | + # add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels) |
| 258 | + self.UPDATE: pgettext("addonStore", "Updatable &add-ons"), |
| 259 | + # Translators: The label of a tab to display available add-ons in the add-on store and the label of the |
| 260 | + # add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels) |
| 261 | + self.AVAILABLE: pgettext("addonStore", "Available &add-ons"), |
| 262 | + # Translators: The label of a tab to display incompatible add-ons in the add-on store and the label of the |
| 263 | + # add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels) |
| 264 | + self.INCOMPATIBLE: pgettext("addonStore", "Installed incompatible &add-ons"), |
257 | 265 | } |
258 | 266 |
|
| 267 | + @property |
| 268 | + def displayStringWithAccelerator(self) -> str: |
| 269 | + """ |
| 270 | + @return: The translated UI display string with accelerator that should be used for this value of the enum. |
| 271 | + """ |
| 272 | + try: |
| 273 | + return self._displayStringLabelsWithAccelerators[self] |
| 274 | + except KeyError as e: |
| 275 | + log.error(f"No translation mapping for: {self}") |
| 276 | + raise e |
| 277 | + |
| 278 | + |
| 279 | + |
259 | 280 |
|
260 | 281 | _statusFilters: OrderedDict[_StatusFilterKey, Set[AvailableAddonStatus]] = OrderedDict({ |
261 | 282 | _StatusFilterKey.INSTALLED: { |
|
0 commit comments