Skip to content

Commit

Permalink
LibLouis 3 transitoin: provide a way to migrate old table names to ne…
Browse files Browse the repository at this point in the history
…w filenames. re nvaccess#6140.

Given that people would be surprised if some tables would revert back to defaults, it would be handy to provide a short migration routine to map old table filenames to new ones. Thus, a tempoary routine and a map is introduced to handle it (to be removed at a future date).
  • Loading branch information
josephsl committed Jul 6, 2016
1 parent 1d1ed09 commit 0aa6f2e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/braille.py
Expand Up @@ -295,6 +295,13 @@
#: Braille tables that support input (only computer braille tables yet).
INPUT_TABLES = tuple(t for t in TABLES if t[2])

#: Old versus new braille table names to be consulted during migration from liblouis 2 to liblouis 3.
OLDTABLENAMES2NEWTABLENAMES = {
"no-no.ctb":"no-no-comp8.ctb",
"UEBC-g1.ctb":"en-ueb-g1.ctb",
"UEBC-g2.ctb":"en-ueb-g2.ctb",
}

roleLabels = {
# Translators: Displayed in braille for an object which is an
# editable text field.
Expand Down Expand Up @@ -1727,6 +1734,10 @@ def initialize():
global handler
config.addConfigDirsToPythonPackagePath(brailleDisplayDrivers)
log.info("Using liblouis version %s" % louis.version())
# #6109 and #6140: Migrate to new table names as smoothly as possible.
oldTableName = config.conf["braille"]["translationTable"]
if oldTableName in OLDTABLENAMES2NEWTABLENAMES:
config.conf["braille"]["translationTable"] = OLDTABLENAMES2NEWTABLENAMES[oldTableName]
handler = BrailleHandler()
handler.setDisplayByName(config.conf["braille"]["display"])

Expand Down

0 comments on commit 0aa6f2e

Please sign in to comment.