|
|
@ -13,9 +13,14 @@ def load_language_in_db():
|
|
|
|
for lang in pycountry.languages
|
|
|
|
for lang in pycountry.languages
|
|
|
|
if hasattr(lang, 'alpha_2')]
|
|
|
|
if hasattr(lang, 'alpha_2')]
|
|
|
|
|
|
|
|
|
|
|
|
# Insert languages in database table
|
|
|
|
# Insert standard languages in database table
|
|
|
|
CustomLanguage.register(TableSettingsLanguages)
|
|
|
|
TableSettingsLanguages.insert_many(langs,
|
|
|
|
|
|
|
|
fields=[TableSettingsLanguages.code3, TableSettingsLanguages.code2,
|
|
|
|
|
|
|
|
TableSettingsLanguages.name]) \
|
|
|
|
|
|
|
|
.on_conflict(action='IGNORE') \
|
|
|
|
|
|
|
|
.execute()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update standard languages with code3b if available
|
|
|
|
langs = [[lang.bibliographic, lang.alpha_3]
|
|
|
|
langs = [[lang.bibliographic, lang.alpha_3]
|
|
|
|
for lang in pycountry.languages
|
|
|
|
for lang in pycountry.languages
|
|
|
|
if hasattr(lang, 'alpha_2') and hasattr(lang, 'bibliographic')]
|
|
|
|
if hasattr(lang, 'alpha_2') and hasattr(lang, 'bibliographic')]
|
|
|
@ -26,6 +31,9 @@ def load_language_in_db():
|
|
|
|
.where(TableSettingsLanguages.code3 == lang[1]) \
|
|
|
|
.where(TableSettingsLanguages.code3 == lang[1]) \
|
|
|
|
.execute()
|
|
|
|
.execute()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Insert custom languages in database table
|
|
|
|
|
|
|
|
CustomLanguage.register(TableSettingsLanguages)
|
|
|
|
|
|
|
|
|
|
|
|
# Create languages dictionary for faster conversion than calling database
|
|
|
|
# Create languages dictionary for faster conversion than calling database
|
|
|
|
create_languages_dict()
|
|
|
|
create_languages_dict()
|
|
|
|
|
|
|
|
|
|
|
|