@login_required
def select_locale(request, document_slug):
 doc = get_object_or_404(Document, locale=settings.WIKI_DEFAULT_LANGUAGE, slug=document_slug)
 translated_locales_code = []
 translated_locales = []
 untranslated_locales = []
 translated_locales_code.append(doc.locale)
 translated_locales_code.extend(doc.translations.all().values_list('locale', flat=True))
 for locale in settings.LANGUAGE_CHOICES:
  if (locale[0] in translated_locales_code):
   translated_locales.append(locale)
  else:
   untranslated_locales.append(locale)
 return render(request, 'wiki/select_locale.html', {'document': doc, 'translated_locales': translated_locales, 'untranslated_locales': untranslated_locales})

@ login_required def select_locale ( request , document_slug ) : doc = get_object_or_404 ( Document , locale = settings . WIKI_DEFAULT_LANGUAGE , slug = document_slug ) translated_locales_code = [ ] translated_locales = [ ] untranslated_locales = [ ] translated_locales_code . append ( doc . locale ) translated_locales_code . extend ( doc . translations . all ( ) . values_list ( 'locale' , flat = True ) ) for locale in settings . LANGUAGE_CHOICES : if ( locale [ 0 ] in translated_locales_code ) : translated_locales . append ( locale ) else : untranslated_locales . append ( locale ) return render ( request , 'wiki/select_locale.html' , { 'document' : doc , 'translated_locales' : translated_locales , 'untranslated_locales' : untranslated_locales } )
select a locale to translate the document to .