def _contextual_locale(context):
 request = context.get('request')
 locale = request.LANGUAGE_CODE
 if (not localedata.exists(locale)):
  locale = settings.LANGUAGE_CODE
 return locale

def _contextual_locale ( context ) : request = context . get ( 'request' ) locale = request . LANGUAGE_CODE if ( not localedata . exists ( locale ) ) : locale = settings . LANGUAGE_CODE return locale
return locale from the context .