mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 09:21:04 +00:00
Merge pull request #68 from StephenSorriaux/fix/languages-reload
Fix `languages` reload
This commit is contained in:
commit
1945f5235c
1 changed files with 3 additions and 4 deletions
|
@ -2,7 +2,7 @@ import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from argostranslate import settings, package, translate
|
from argostranslate import settings, package, translate
|
||||||
import os, glob, shutil, zipfile
|
import os, glob, shutil, zipfile
|
||||||
from app.language import languages
|
import app.language
|
||||||
import polyglot
|
import polyglot
|
||||||
|
|
||||||
def boot(load_only=None):
|
def boot(load_only=None):
|
||||||
|
@ -45,14 +45,13 @@ def check_and_install_models(force=False, load_only_lang_codes=None):
|
||||||
package.install_from_path(download_path)
|
package.install_from_path(download_path)
|
||||||
|
|
||||||
# reload installed languages
|
# reload installed languages
|
||||||
global languages
|
app.language.languages = translate.load_installed_languages()
|
||||||
languages = translate.load_installed_languages()
|
|
||||||
print("Loaded support for %s languages (%s models total)!" % (len(translate.load_installed_languages()), len(available_packages)))
|
print("Loaded support for %s languages (%s models total)!" % (len(translate.load_installed_languages()), len(available_packages)))
|
||||||
|
|
||||||
|
|
||||||
def check_and_install_transliteration(force=False):
|
def check_and_install_transliteration(force=False):
|
||||||
# 'en' is not a supported transliteration language
|
# 'en' is not a supported transliteration language
|
||||||
transliteration_languages = [l.code for l in languages if l.code != "en"]
|
transliteration_languages = [l.code for l in app.language.languages if l.code != "en"]
|
||||||
|
|
||||||
# check installed
|
# check installed
|
||||||
install_needed = []
|
install_needed = []
|
||||||
|
|
Loading…
Reference in a new issue