Skip to content

Commit

Permalink
Fix translatable string issue in Albatross driver (#17116)
Browse files Browse the repository at this point in the history
Summary of the issue:
In Albatross driver, a string consisting in the concatenation of normal strings (`"..."`) and an f-string) is passed to the `_` translation function. As a consequence:
* Only a part of the concatenated string appears in the `.pot` file instead of the full concatenation
* In any case, f-strings cannot be used for translatable messages since the formatting should be applied only after the gettext function has been called

Thus, this message was not translated.

Description of user facing changes
The message of the Albatross driver is now translated.

Description of development approach
Do not use f-string. Instead used `.format` function, applied to the translated string. Slightly reworded the returned message for clarity.

Testing strategy:
- Check in the `.pot` file that we have the full message

Known issues with pull request:
None
  • Loading branch information
CyrilleB79 committed Sep 5, 2024
1 parent 51cb2bf commit dbdde44
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions source/brailleDisplayDrivers/albatross/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,9 @@ def _skipRedundantInitPackets(self, data: bytes) -> bool:
_(
# Translators: A message when number of status cells must be changed
# for a braille display driver
"To use Albatross with NVDA: "
"change number of status cells in Albatross internal menu at most "
f"to {MAX_STATUS_CELLS_ALLOWED}, and if needed, restart Albatross "
"and NVDA.",
),
"To use an Albatross with NVDA, change the number of status cells in the Albatross's internal menu "
"to at most {maxCells}, and restart the Albatross and NVDA if needed.",
).format(maxCells=MAX_STATUS_CELLS_ALLOWED),
)
self._disableConnection()
return False
Expand Down

0 comments on commit dbdde44

Please sign in to comment.