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
+13
View File
@@ -13,6 +13,8 @@
import logging
import nw
from nw.constants import isoLanguage
logger = logging.getLogger(__name__)
class NWSpellCheck():
@@ -54,6 +56,17 @@ class NWSpellCheck():
def listDictionaries(self):
return []
@staticmethod
def expandLanguage(spTag):
spBits = spTag.split("_")
if spBits[0] in isoLanguage.ISO_639_1:
spLang = isoLanguage.ISO_639_1[spBits[0]]
else:
spLang = spBits[0]
if len(spBits) > 1:
spLang += " (%s)" % spBits[1]
return spLang
##
# Internal Functions
##