# Path: modeltranslation/settings.py
# AVAILABLE_LANGUAGES = list(
#     getattr(
#         settings,
#         "MODELTRANSLATION_LANGUAGES",
#         (val for val, label in settings.LANGUAGES),
#     )
# )
# 
# Path: modeltranslation/translator.py
# class AlreadyRegistered(Exception):
# class NotRegistered(Exception):
# class DescendantRegistered(Exception):
# class FieldsAggregationMetaClass(type):
# class TranslationOptions(with_metaclass(FieldsAggregationMetaClass, object)):
# class MultilingualOptions(options.Options):
#         class NewMultilingualManager(
#             MultilingualManager, manager.__class__, MultilingualQuerysetManager
#         ):
#     class NewSingleObjectDescriptor(LanguageCacheSingleObjectDescriptor, ro_descriptor.__class__):
# class Translator(object):
#     def __new__(cls, name, bases, attrs):
#     def __init__(self, model):
#     def validate(self):
#     def _check_languages(self, languages, extra=()):
#     def update(self, other):
#     def add_translation_field(self, field, translation_field):
#     def get_field_names(self):
#     def __str__(self):
#     def base_manager(self):
# def add_translation_fields(model, opts):
# def has_custom_queryset(manager):
# def patch_manager_class(manager):
#             def deconstruct(self):
#             def __hash__(self):
#             def __eq__(self, other):
# def add_manager(model):
# def patch_constructor(model):
#     def new_init(self, *args, **kwargs):
# def delete_mt_init(sender, instance, **kwargs):
# def patch_clean_fields(model):
#     def new_clean_fields(self, exclude=None):
# def patch_get_deferred_fields(model):
#     def new_get_deferred_fields(self):
# def patch_refresh_from_db(model):
#     def new_refresh_from_db(self, using=None, fields=None):
# def delete_cache_fields(model):
# def populate_translation_fields(sender, kwargs):
# def patch_related_object_descriptor_caching(ro_descriptor):
#     def __init__(self):
#     def register(self, model_or_iterable, opts_class=None, **options):
#     def _register_single_model(self, model, opts):
#     def unregister(self, model_or_iterable):
#     def get_registered_models(self, abstract=True):
#     def _get_options_for_model(self, model, opts_class=None, **options):
#     def get_options_for_model(self, model):
# 
# Path: modeltranslation/utils.py
# def build_localized_fieldname(field_name, lang):
#     if lang == 'id':
#         # The 2-letter Indonesian language code is problematic with the
#         # current naming scheme as Django foreign keys also add "id" suffix.
#         lang = 'ind'
#     return str('%s_%s' % (field_name, lang.replace('-', '_')))


from django import VERSION
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.db import connection
from six import moves
from modeltranslation.settings import AVAILABLE_LANGUAGES
from modeltranslation.translator import translator
from modeltranslation.utils import build_localized_fieldname
        from optparse import make_option
                if missing_langs:
                    found_missing_fields = True
                    print_missing_langs(missing_langs, field_name, model_full_name)
                    sql_sentences = self.get_sync_sql(field_name, missing_langs, model)
                    execute_sql = ask_for_confirmation(
                        sql_sentences, model_full_name, self.interactive
                    )
                    if execute_sql:
                        print('Executing SQL...')
                        for sentence in sql_sentences:
                            self.cursor.execute(sentence)
                        print('Done')
                    else:
                        print('SQL not executed')

        if not found_missing_fields:
            print('No new translatable fields detected')

    def get_table_fields(self, db_table):
        """
        Gets table fields from schema.
        """
        db_table_desc = self.introspection.get_table_description(self.cursor, db_table)
        return [t[0] for t in db_table_desc]

    def get_missing_languages(self, field_name, db_table):
        """
        Gets only missings fields.
        """
        db_table_fields = self.get_table_fields(db_table)

# Path: modeltranslation/settings.py
# AVAILABLE_LANGUAGES = list(
#     getattr(
#         settings,
#         "MODELTRANSLATION_LANGUAGES",
#         (val for val, label in settings.LANGUAGES),
#     )
# )
# 
# Path: modeltranslation/translator.py
# class AlreadyRegistered(Exception):
# class NotRegistered(Exception):
# class DescendantRegistered(Exception):
# class FieldsAggregationMetaClass(type):
# class TranslationOptions(with_metaclass(FieldsAggregationMetaClass, object)):
# class MultilingualOptions(options.Options):
#         class NewMultilingualManager(
#             MultilingualManager, manager.__class__, MultilingualQuerysetManager
#         ):
#     class NewSingleObjectDescriptor(LanguageCacheSingleObjectDescriptor, ro_descriptor.__class__):
# class Translator(object):
#     def __new__(cls, name, bases, attrs):
#     def __init__(self, model):
#     def validate(self):
#     def _check_languages(self, languages, extra=()):
#     def update(self, other):
#     def add_translation_field(self, field, translation_field):
#     def get_field_names(self):
#     def __str__(self):
#     def base_manager(self):
# def add_translation_fields(model, opts):
# def has_custom_queryset(manager):
# def patch_manager_class(manager):
#             def deconstruct(self):
#             def __hash__(self):
#             def __eq__(self, other):
# def add_manager(model):
# def patch_constructor(model):
#     def new_init(self, *args, **kwargs):
# def delete_mt_init(sender, instance, **kwargs):
# def patch_clean_fields(model):
#     def new_clean_fields(self, exclude=None):
# def patch_get_deferred_fields(model):
#     def new_get_deferred_fields(self):
# def patch_refresh_from_db(model):
#     def new_refresh_from_db(self, using=None, fields=None):
# def delete_cache_fields(model):
# def populate_translation_fields(sender, kwargs):
# def patch_related_object_descriptor_caching(ro_descriptor):
#     def __init__(self):
#     def register(self, model_or_iterable, opts_class=None, **options):
#     def _register_single_model(self, model, opts):
#     def unregister(self, model_or_iterable):
#     def get_registered_models(self, abstract=True):
#     def _get_options_for_model(self, model, opts_class=None, **options):
#     def get_options_for_model(self, model):
# 
# Path: modeltranslation/utils.py
# def build_localized_fieldname(field_name, lang):
#     if lang == 'id':
#         # The 2-letter Indonesian language code is problematic with the
#         # current naming scheme as Django foreign keys also add "id" suffix.
#         lang = 'ind'
#     return str('%s_%s' % (field_name, lang.replace('-', '_')))


# Path: modeltranslation/management/commands/sync_translation_fields.py
from django import VERSION
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.db import connection
from six import moves
from modeltranslation.settings import AVAILABLE_LANGUAGES
from modeltranslation.translator import translator
from modeltranslation.utils import build_localized_fieldname
        from optparse import make_option

                if missing_langs:
                    found_missing_fields = True
                    print_missing_langs(missing_langs, field_name, model_full_name)
                    sql_sentences = self.get_sync_sql(field_name, missing_langs, model)
                    execute_sql = ask_for_confirmation(
                        sql_sentences, model_full_name, self.interactive
                    )
                    if execute_sql:
                        print('Executing SQL...')
                        for sentence in sql_sentences:
                            self.cursor.execute(sentence)
                        print('Done')
                    else:
                        print('SQL not executed')

        if not found_missing_fields:
            print('No new translatable fields detected')

    def get_table_fields(self, db_table):
        """
        Gets table fields from schema.
        """
        db_table_desc = self.introspection.get_table_description(self.cursor, db_table)
        return [t[0] for t in db_table_desc]

    def get_missing_languages(self, field_name, db_table):
        """
        Gets only missings fields.
        """
        db_table_fields = self.get_table_fields(db_table)

        for lang_code in AVAILABLE_LANGUAGES: