2016-09-24 16:42:01 +03:00
|
|
|
import pathlib
|
|
|
|
|
|
|
|
from .util import set_lang_class, get_lang_class
|
2016-11-04 23:21:02 +03:00
|
|
|
from .about import __version__
|
2016-01-15 20:01:02 +03:00
|
|
|
|
2016-04-12 17:31:16 +03:00
|
|
|
from . import en
|
|
|
|
from . import de
|
2016-04-24 19:45:16 +03:00
|
|
|
from . import zh
|
2016-11-02 22:05:14 +03:00
|
|
|
from . import es
|
|
|
|
from . import it
|
2016-12-21 22:45:36 +03:00
|
|
|
from . import hu
|
2016-11-02 22:48:29 +03:00
|
|
|
from . import fr
|
2016-11-02 22:05:14 +03:00
|
|
|
from . import pt
|
2016-11-24 18:39:49 +03:00
|
|
|
from . import nl
|
2016-12-20 13:05:06 +03:00
|
|
|
from . import sv
|
2017-02-01 01:27:29 +03:00
|
|
|
from . import fi
|
2016-03-24 13:19:43 +03:00
|
|
|
|
2016-09-24 23:09:21 +03:00
|
|
|
try:
|
2016-09-24 23:17:01 +03:00
|
|
|
basestring
|
2016-09-24 23:09:21 +03:00
|
|
|
except NameError:
|
2016-09-24 23:17:01 +03:00
|
|
|
basestring = str
|
2016-09-24 23:09:21 +03:00
|
|
|
|
|
|
|
|
2016-04-12 17:31:16 +03:00
|
|
|
set_lang_class(en.English.lang, en.English)
|
|
|
|
set_lang_class(de.German.lang, de.German)
|
2016-11-02 22:05:14 +03:00
|
|
|
set_lang_class(es.Spanish.lang, es.Spanish)
|
|
|
|
set_lang_class(pt.Portuguese.lang, pt.Portuguese)
|
|
|
|
set_lang_class(fr.French.lang, fr.French)
|
|
|
|
set_lang_class(it.Italian.lang, it.Italian)
|
2016-12-08 01:07:43 +03:00
|
|
|
set_lang_class(hu.Hungarian.lang, hu.Hungarian)
|
2016-04-24 19:45:16 +03:00
|
|
|
set_lang_class(zh.Chinese.lang, zh.Chinese)
|
2016-11-29 18:42:05 +03:00
|
|
|
set_lang_class(nl.Dutch.lang, nl.Dutch)
|
2016-12-20 13:05:06 +03:00
|
|
|
set_lang_class(sv.Swedish.lang, sv.Swedish)
|
2017-02-01 01:27:29 +03:00
|
|
|
set_lang_class(fi.Finnish.lang, fi.Finnish)
|
|
|
|
|
2016-03-25 20:54:45 +03:00
|
|
|
|
|
|
|
|
2016-10-18 20:23:31 +03:00
|
|
|
def load(name, **overrides):
|
2016-09-26 12:07:46 +03:00
|
|
|
target_name, target_version = util.split_data_name(name)
|
2016-10-20 19:27:48 +03:00
|
|
|
data_path = overrides.get('path', util.get_data_path())
|
|
|
|
path = util.match_best_version(target_name, target_version, data_path)
|
2016-09-24 21:26:17 +03:00
|
|
|
cls = get_lang_class(target_name)
|
2016-12-19 00:15:29 +03:00
|
|
|
overrides['path'] = path
|
|
|
|
return cls(**overrides)
|