# Path: modeltranslation/settings.py
# TRANSLATION_FILES = tuple(getattr(settings, "MODELTRANSLATION_TRANSLATION_FILES", ()))
# AVAILABLE_LANGUAGES = list(
#     getattr(
#         settings,
#         "MODELTRANSLATION_LANGUAGES",
#         (val for val, label in settings.LANGUAGES),
#     )
# )
# DEFAULT_LANGUAGE = getattr(settings, "MODELTRANSLATION_DEFAULT_LANGUAGE", None)
#     DEFAULT_LANGUAGE = AVAILABLE_LANGUAGES[0]
# PREPOPULATE_LANGUAGE = getattr(settings, "MODELTRANSLATION_PREPOPULATE_LANGUAGE", None)
# CUSTOM_FIELDS = getattr(settings, "MODELTRANSLATION_CUSTOM_FIELDS", ())
# ENABLE_REGISTRATIONS = getattr(settings, "MODELTRANSLATION_ENABLE_REGISTRATIONS", settings.USE_I18N)
# DEBUG = getattr(settings, "MODELTRANSLATION_DEBUG", False)
# AUTO_POPULATE = getattr(settings, "MODELTRANSLATION_AUTO_POPULATE", False)
# FALLBACK_LANGUAGES = getattr(settings, "MODELTRANSLATION_FALLBACK_LANGUAGES", (DEFAULT_LANGUAGE,))
#     FALLBACK_LANGUAGES = {"default": tuple(FALLBACK_LANGUAGES)}
# ENABLE_FALLBACKS = getattr(settings, "MODELTRANSLATION_ENABLE_FALLBACKS", True)
# LOADDATA_RETAIN_LOCALE = getattr(settings, "MODELTRANSLATION_LOADDATA_RETAIN_LOCALE", True)
# JQUERY_URL = getattr(
#     settings,
#     "JQUERY_URL",
#     "//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js",
# )
# JQUERY_UI_URL = getattr(
#     settings,
#     "JQUERY_UI_URL",
#     "//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js",
# )
# 
# Path: modeltranslation/utils.py
# @contextmanager
# def auto_populate(mode='all'):
#     """
#     Overrides translation fields population mode (population mode decides which
#     unprovided translations will be filled during model construction / loading).
# 
#     Example:
# 
#         with auto_populate('all'):
#             s = Slugged.objects.create(title='foo')
#         s.title_en == 'foo' // True
#         s.title_de == 'foo' // True
# 
#     This method may be used to ensure consistency loading untranslated fixtures,
#     with non-default language active:
# 
#         with auto_populate('required'):
#             call_command('loaddata', 'fixture.json')
#     """
#     current_population_mode = settings.AUTO_POPULATE
#     settings.AUTO_POPULATE = mode
#     try:
#         yield
#     finally:
#         settings.AUTO_POPULATE = current_population_mode


from django import VERSION
from django.core.management.commands.loaddata import Command as LoadDataCommand
from modeltranslation import settings as mt_settings
from modeltranslation.utils import auto_populate
        from optparse import make_option
            from django.utils import translation
            from django.utils import translation
        import argparse

# Because this command is used (instead of default loaddata), then settings have been imported
# and we can safely import MT modules


ALLOWED = (None, False, 'all', 'default', 'required')
ALLOWED_FOR_PRINT = ', '.join(str(i) for i in (0,) + ALLOWED[1:])  # For pretty-printing


def check_mode(option, opt_str, value, parser, namespace=None):
    if value == '0' or value.lower() == 'false':
        value = False
    if value not in ALLOWED:
        raise ValueError("%s option can be only one of: %s" % (opt_str, ALLOWED_FOR_PRINT))
    setattr(namespace or parser.values, option.dest, value)


class Command(LoadDataCommand):

# Path: modeltranslation/settings.py
# TRANSLATION_FILES = tuple(getattr(settings, "MODELTRANSLATION_TRANSLATION_FILES", ()))
# AVAILABLE_LANGUAGES = list(
#     getattr(
#         settings,
#         "MODELTRANSLATION_LANGUAGES",
#         (val for val, label in settings.LANGUAGES),
#     )
# )
# DEFAULT_LANGUAGE = getattr(settings, "MODELTRANSLATION_DEFAULT_LANGUAGE", None)
#     DEFAULT_LANGUAGE = AVAILABLE_LANGUAGES[0]
# PREPOPULATE_LANGUAGE = getattr(settings, "MODELTRANSLATION_PREPOPULATE_LANGUAGE", None)
# CUSTOM_FIELDS = getattr(settings, "MODELTRANSLATION_CUSTOM_FIELDS", ())
# ENABLE_REGISTRATIONS = getattr(settings, "MODELTRANSLATION_ENABLE_REGISTRATIONS", settings.USE_I18N)
# DEBUG = getattr(settings, "MODELTRANSLATION_DEBUG", False)
# AUTO_POPULATE = getattr(settings, "MODELTRANSLATION_AUTO_POPULATE", False)
# FALLBACK_LANGUAGES = getattr(settings, "MODELTRANSLATION_FALLBACK_LANGUAGES", (DEFAULT_LANGUAGE,))
#     FALLBACK_LANGUAGES = {"default": tuple(FALLBACK_LANGUAGES)}
# ENABLE_FALLBACKS = getattr(settings, "MODELTRANSLATION_ENABLE_FALLBACKS", True)
# LOADDATA_RETAIN_LOCALE = getattr(settings, "MODELTRANSLATION_LOADDATA_RETAIN_LOCALE", True)
# JQUERY_URL = getattr(
#     settings,
#     "JQUERY_URL",
#     "//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js",
# )
# JQUERY_UI_URL = getattr(
#     settings,
#     "JQUERY_UI_URL",
#     "//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js",
# )
# 
# Path: modeltranslation/utils.py
# @contextmanager
# def auto_populate(mode='all'):
#     """
#     Overrides translation fields population mode (population mode decides which
#     unprovided translations will be filled during model construction / loading).
# 
#     Example:
# 
#         with auto_populate('all'):
#             s = Slugged.objects.create(title='foo')
#         s.title_en == 'foo' // True
#         s.title_de == 'foo' // True
# 
#     This method may be used to ensure consistency loading untranslated fixtures,
#     with non-default language active:
# 
#         with auto_populate('required'):
#             call_command('loaddata', 'fixture.json')
#     """
#     current_population_mode = settings.AUTO_POPULATE
#     settings.AUTO_POPULATE = mode
#     try:
#         yield
#     finally:
#         settings.AUTO_POPULATE = current_population_mode


# Path: modeltranslation/management/commands/loaddata.py
from django import VERSION
from django.core.management.commands.loaddata import Command as LoadDataCommand
from modeltranslation import settings as mt_settings
from modeltranslation.utils import auto_populate
        from optparse import make_option
            from django.utils import translation
            from django.utils import translation
        import argparse


# Because this command is used (instead of default loaddata), then settings have been imported
# and we can safely import MT modules


ALLOWED = (None, False, 'all', 'default', 'required')
ALLOWED_FOR_PRINT = ', '.join(str(i) for i in (0,) + ALLOWED[1:])  # For pretty-printing


def check_mode(option, opt_str, value, parser, namespace=None):
    if value == '0' or value.lower() == 'false':
        value = False
    if value not in ALLOWED:
        raise ValueError("%s option can be only one of: %s" % (opt_str, ALLOWED_FOR_PRINT))
    setattr(namespace or parser.values, option.dest, value)


class Command(LoadDataCommand):

    leave_locale_alone = mt_settings.LOADDATA_RETAIN_LOCALE  # Django 1.6