Added a function to create a readable spell language string for the status bar

This commit is contained in:
Veronica K. B. Olsen
2019-11-08 19:56:08 +01:00
parent 79aa33da94
commit 7fcd0731bf
3 changed files with 16 additions and 22 deletions
+1 -10
View File
@@ -15,7 +15,6 @@ import enchant
import nw
from nw.tools.spellcheck import NWSpellCheck
from nw.constants import isoLanguage
logger = logging.getLogger(__name__)
@@ -58,15 +57,7 @@ class NWSpellEnchant(NWSpellCheck):
def listDictionaries(self):
retList = []
for spTag, spProvider in enchant.list_dicts():
spList = []
if spTag[:2] in isoLanguage.ISO_639_1:
spList.append(isoLanguage.ISO_639_1[spTag[:2]])
else:
spList.append(spTag[:2])
if len(spTag) > 3:
spList.append("(%s)" % spTag[3:])
spList.append("[%s]" % spProvider.name)
spName = " ".join(spList)
spName = "%s [%s]" % (self.expandLanguage(spTag), spProvider.name)
retList.append((spTag, spName))
return retList