def __init__(self, lang, val_popcon, progress=None): self.val_popcon = val_popcon self.progress = progress if lang is None: lang = "en" self.lang = lang self.xlang = lang.split("_")[0] self.xdglangs = Locale.expand_languages(lang) self.indexer = xapian.TermGenerator() # Get a stemmer for this language, if available try: self.stemmer = xapian.Stem(self.xlang) self.indexer.set_stemmer(self.stemmer) except xapian.InvalidArgumentError: pass
from xdg import Locale print(Locale.expand_languages())
def test_expand_languages(self): langs = Locale.expand_languages() assert isinstance(langs, list)