# Path: modeltrans/conf.py
# def check_fallback_chain():
#     MODELTRANS_FALLBACK = get_modeltrans_setting("MODELTRANS_FALLBACK")
#     MODELTRANS_AVAILABLE_LANGUAGES = get_available_languages(include_default=True)
# 
#     if "default" not in MODELTRANS_FALLBACK:
#         raise ImproperlyConfigured("MODELTRANS_FALLBACK setting must have a `default` key.")
# 
#     message_fmt = (
#         "MODELTRANS_FALLBACK contains language `{}` "
#         "which is not in MODELTRANS_AVAILABLE_LANGUAGES"
#     )
#     for lang, chain in MODELTRANS_FALLBACK.items():
#         if lang != "default" and lang not in MODELTRANS_AVAILABLE_LANGUAGES:
#             raise ImproperlyConfigured(message_fmt.format(lang))
#         for lang in chain:
#             if lang not in MODELTRANS_AVAILABLE_LANGUAGES:
#                 raise ImproperlyConfigured(message_fmt.format(lang))
# 
# Path: modeltrans/translator.py
# def translate_model(Model):
#     i18n_field = get_i18n_field(Model)
# 
#     if i18n_field is None:
#         return
# 
#     if not i18n_field.virtual_fields:
#         # This mode is required for the migration process:
#         # It needs to have a stage where we do have the TranslationField,
#         # but not the virtual fields (which would collide with the
#         # django-modeltranslation `<field>_<lang>`-fields), to be able to
#         # copy the values from the `<field>_<lang>`-fields into `i18n.<field>_<lang>`.
#         return
# 
#     validate(Model)
# 
#     add_manager(Model)
#     fields_to_translate = get_i18n_field_param(Model, i18n_field, "fields")
#     required_languages = get_i18n_field_param(Model, i18n_field, "required_languages")
#     add_virtual_fields(Model, fields_to_translate, required_languages)
#     patch_constructor(Model)
# 
#     translate_meta_ordering(Model)


import django.apps
from django.apps import AppConfig
from .conf import check_fallback_chain
from .translator import translate_model



class RegistrationConfig(AppConfig):
    name = "modeltrans"
    verbose_name = "Django modeltrans using a registry."

    def ready(self):

# Path: modeltrans/conf.py
# def check_fallback_chain():
#     MODELTRANS_FALLBACK = get_modeltrans_setting("MODELTRANS_FALLBACK")
#     MODELTRANS_AVAILABLE_LANGUAGES = get_available_languages(include_default=True)
# 
#     if "default" not in MODELTRANS_FALLBACK:
#         raise ImproperlyConfigured("MODELTRANS_FALLBACK setting must have a `default` key.")
# 
#     message_fmt = (
#         "MODELTRANS_FALLBACK contains language `{}` "
#         "which is not in MODELTRANS_AVAILABLE_LANGUAGES"
#     )
#     for lang, chain in MODELTRANS_FALLBACK.items():
#         if lang != "default" and lang not in MODELTRANS_AVAILABLE_LANGUAGES:
#             raise ImproperlyConfigured(message_fmt.format(lang))
#         for lang in chain:
#             if lang not in MODELTRANS_AVAILABLE_LANGUAGES:
#                 raise ImproperlyConfigured(message_fmt.format(lang))
# 
# Path: modeltrans/translator.py
# def translate_model(Model):
#     i18n_field = get_i18n_field(Model)
# 
#     if i18n_field is None:
#         return
# 
#     if not i18n_field.virtual_fields:
#         # This mode is required for the migration process:
#         # It needs to have a stage where we do have the TranslationField,
#         # but not the virtual fields (which would collide with the
#         # django-modeltranslation `<field>_<lang>`-fields), to be able to
#         # copy the values from the `<field>_<lang>`-fields into `i18n.<field>_<lang>`.
#         return
# 
#     validate(Model)
# 
#     add_manager(Model)
#     fields_to_translate = get_i18n_field_param(Model, i18n_field, "fields")
#     required_languages = get_i18n_field_param(Model, i18n_field, "required_languages")
#     add_virtual_fields(Model, fields_to_translate, required_languages)
#     patch_constructor(Model)
# 
#     translate_meta_ordering(Model)


# Path: modeltrans/apps.py
import django.apps
from django.apps import AppConfig
from .conf import check_fallback_chain
from .translator import translate_model




class RegistrationConfig(AppConfig):
    name = "modeltrans"
    verbose_name = "Django modeltrans using a registry."

    def ready(self):

        check_fallback_chain()