def geoip_suggestion(request):
 locales = request.GET.getlist('locales[]')
 response = {'locales': {}}
 for locale in locales:
  response['locales'][locale] = LOCALES[locale]
  with uselocale(locale):
   response[locale] = {'suggestion': _('Would you like to view this page in %(language)s instead?'), 'confirm': _('Yes'), 'cancel': _('No')}
 return HttpResponse(json.dumps(response), content_type='application/json')

def geoip_suggestion ( request ) : locales = request . GET . getlist ( 'locales[]' ) response = { 'locales' : { } } for locale in locales : response [ 'locales' ] [ locale ] = LOCALES [ locale ] with uselocale ( locale ) : response [ locale ] = { 'suggestion' : _ ( 'Would you like to view this page in %(language)s instead?' ) , 'confirm' : _ ( 'Yes' ) , 'cancel' : _ ( 'No' ) } return HttpResponse ( json . dumps ( response ) , content_type = 'application/json' )
ajax view to return the localized text for geoip locale change suggestion .