Explorar el Código

Fixed menu sorting

Marcos Dumay de Medeiros hace 8 años
padre
commit
c32ee300ea
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      src/rapid/templatetags/rapid_menu.py

+ 6 - 0
src/rapid/templatetags/rapid_menu.py

@@ -5,9 +5,15 @@ from django import template
 from django.utils.safestring import mark_safe
 from django.utils.html import escape
 from rapid.views import registry, ModelData
+from django.utils.translation import to_locale, get_language
 
 register = template.Library()
 
+try:
+    locale.setlocale(locale.LC_ALL, str(to_locale(get_language())))
+except:
+    locale.setlocale(locale.LC_ALL, str('C'))
+
 def _app_menu(app, request):
     models = list(app.models)
     models.sort(key=lambda m: ModelData(m).model_name(), cmp=locale.strcoll)