Skip to content

Commit

Permalink
Set default input and translation tables according to NVDA's language (
Browse files Browse the repository at this point in the history
…nvaccess#17222)

Fixes nvaccess#16390
Fixes nvaccess#290

Summary of the issue:
By default, NVDA should set braille tables according to the current NVDA's language.

Description of user facing changes
When NVDA starts, if no default input and translation braille tables have been set, the default tables will be selected according to NVDA's languages. This will also happen when NVDA's language is changed.

Description of development approach
Modified the addTable function in the brailleTables module, to create dictionaries to associate languages with input and translation tables.
Modified config spec, and the handler of postConfigProfileSwitch in brailleOutput and braille modules, to set the appropriate table according to NVDA language
Modified gui function to aply changes when language is changed.
  • Loading branch information
nvdaes authored Oct 18, 2024
1 parent e9a9311 commit 64ba6c6
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 79 deletions.
4 changes: 4 additions & 0 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,10 @@ def handlePostConfigProfileSwitch(self):

if (configuredTether := config.conf["braille"]["tetherTo"]) != TetherTo.AUTO.value:
self._tether = configuredTether
if config.conf["braille"]["translationTable"] == "auto":
config.conf["braille"]["translationTable"] = brailleTables.getDefaultTableForCurLang(
brailleTables.TableType.OUTPUT,
)
tableName = config.conf["braille"]["translationTable"]
# #6140: Migrate to new table names as smoothly as possible.
newTableName = brailleTables.RENAMED_TABLES.get(tableName)
Expand Down
4 changes: 4 additions & 0 deletions source/brailleInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ def handleCaretMove(self, obj):
self.flushBuffer()

def handlePostConfigProfileSwitch(self):
if config.conf["braille"]["inputTable"] == "auto":
config.conf["braille"]["inputTable"] = brailleTables.getDefaultTableForCurLang(
brailleTables.TableType.INPUT,
)
# #6140: Migrate to new table names as smoothly as possible.
tableName = config.conf["braille"]["inputTable"]
newTableName = brailleTables.RENAMED_TABLES.get(tableName)
Expand Down
Loading

0 comments on commit 64ba6c6

Please sign in to comment.