@@ -4388,11 +4388,20 @@ def makeSettings(self, settingsSizer):
43884388 outputsLabelText = _ ("&Output table:" )
43894389 self .outTables = [table for table in tables if table .output ]
43904390 self .outTableNames = [table .fileName for table in self .outTables ]
4391- outTableChoices = [table .displayName for table in self .outTables ]
4391+ outTableForCurLangIndex = self .outTableNames .index (
4392+ brailleTables .getDefaultTableForCurLang (brailleTables .TableType .OUTPUT ),
4393+ )
4394+ self .outTableForCurLang = self .outTables [outTableForCurLangIndex ]
4395+ # Translators: An option in Braille settings to select a braille table automatically, according to the current language.
4396+ outTableChoices = [_ ("Automatic ({name})" ).format (name = self .outTableForCurLang .displayName ]
4397+ outTableChoices .extend ([table .displayName for table in self .outTables ])
43924398 self .outTableList = sHelper .addLabeledControl (outputsLabelText , wx .Choice , choices = outTableChoices )
43934399 self .bindHelpEvent ("BrailleSettingsOutputTable" , self .outTableList )
43944400 try :
4395- selection = self .outTables .index (braille .handler .table )
4401+ if config .conf ["braille" ]["translationTable" ] == "auto" :
4402+ selection = 0
4403+ else :
4404+ selection = self .outTables .index (braille .handler .table ) + 1
43964405 self .outTableList .SetSelection (selection )
43974406 except : # noqa: E722
43984407 log .exception ()
@@ -4405,11 +4414,21 @@ def makeSettings(self, settingsSizer):
44054414 # Translators: The label for a setting in braille settings to select the input table (the braille table used to type braille characters on a braille keyboard).
44064415 inputLabelText = _ ("&Input table:" )
44074416 self .inTables = [table for table in tables if table .input ]
4408- inTableChoices = [table .displayName for table in self .inTables ]
4417+ self .inTableNames = [table .fileName for table in self .inTables ]
4418+ inTableForCurLangIndex = self .inTableNames .index (
4419+ brailleTables .getDefaultTableForCurLang (brailleTables .TableType .INPUT ),
4420+ )
4421+ self .inTableForCurLang = self .inTables [inTableForCurLangIndex ]
4422+ # Translators: An option in Braille settings to select a braille table automatically, according to the current language.
4423+ inTableChoices = [_ ("Automatic (%s)" % self .inTableForCurLang .displayName )]
4424+ inTableChoices .extend ([table .displayName for table in self .inTables ])
44094425 self .inTableList = sHelper .addLabeledControl (inputLabelText , wx .Choice , choices = inTableChoices )
44104426 self .bindHelpEvent ("BrailleSettingsInputTable" , self .inTableList )
44114427 try :
4412- selection = self .inTables .index (brailleInput .handler .table )
4428+ if config .conf ["braille" ]["inputTable" ] == "auto" :
4429+ selection = 0
4430+ else :
4431+ selection = self .inTables .index (brailleInput .handler .table ) + 1
44134432 self .inTableList .SetSelection (selection )
44144433 except : # noqa: E722
44154434 log .exception ()
@@ -4714,13 +4733,19 @@ def makeSettings(self, settingsSizer):
47144733
47154734 def onSave (self ):
47164735 AutoSettingsMixin .onSave (self )
4717-
4718- braille .handler .table = self .outTables [self .outTableList .GetSelection ()]
4719- brailleInput .handler .table = self .inTables [self .inTableList .GetSelection ()]
4736+ if self .outTableList .GetSelection () > 0 :
4737+ braille .handler .table = self .outTables [self .outTableList .GetSelection () - 1 ]
4738+ else :
4739+ braille .handler .table = self .outTableForCurLang
4740+ config .conf ["braille" ]["translationTable" ] = "auto"
4741+ if self .inTableList .GetSelection ():
4742+ brailleInput .handler .table = self .inTables [self .inTableList .GetSelection () - 1 ]
4743+ else :
4744+ brailleInput .handler .table = self .inTableForCurLang
4745+ config .conf ["braille" ]["inputTable" ] = "auto"
47204746 mode = list (braille .BrailleMode )[self .brailleModes .GetSelection ()]
47214747 config .conf ["braille" ]["mode" ] = mode .value
47224748 braille .handler .mainBuffer .clear ()
4723- config .conf ["braille" ]["translationTable" ] = self .outTableNames [self .outTableList .GetSelection ()]
47244749 config .conf ["braille" ]["expandAtCursor" ] = self .expandAtCursorCheckBox .GetValue ()
47254750 config .conf ["braille" ]["showCursor" ] = self .showCursorCheckBox .GetValue ()
47264751 config .conf ["braille" ]["cursorBlink" ] = self .cursorBlinkCheckBox .GetValue ()
0 commit comments