Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed #2089: added language bidirectional support and updated the adm…

…in to use it. thanks meir@mksoft!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7e88ec527107bd2c9023d48bcf177636eebc7e7a 1 parent 05b1a70
authored June 06, 2006
5  django/contrib/admin/media/css/base_rtl.css
... ...
@@ -0,0 +1,5 @@
  1
+@import url('base.css');
  2
+
  3
+body {
  4
+    direction: rtl;
  5
+}
7  django/contrib/admin/media/css/login_rtl.css
... ...
@@ -0,0 +1,7 @@
  1
+@import url('login.css');
  2
+@import url('base_rtl.css');
  3
+@import url('layout_rtl.css');
  4
+
  5
+.login .form-row { float:right; }
  6
+.login .form-row label { float:right; padding-left:0.5em; padding-right:0; text-align:left;}
  7
+.login .submit-row { clear:both; padding:1em 9.4em 0 0; }
2  django/contrib/admin/templates/admin/base.html
@@ -2,7 +2,7 @@
2 2
 <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}">
3 3
 <head>
4 4
 <title>{% block title %}{% endblock %}</title>
5  
-<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" />
  5
+<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %}" />
6 6
 {% block extrastyle %}{% endblock %}
7 7
 {% block extrahead %}{% endblock %}
8 8
 </head>
2  django/contrib/admin/templates/admin/login.html
... ...
@@ -1,7 +1,7 @@
1 1
 {% extends "admin/base_site.html" %}
2 2
 {% load i18n %}
3 3
 
4  
-{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login.css{% endblock %}
  4
+{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %}
5 5
 {% block bodyclass %}login{% endblock %}
6 6
 {% block content_title %}{% endblock %}
7 7
 {% block breadcrumbs %}{% endblock %}
4  django/core/context_processors.py
@@ -36,6 +36,10 @@ def i18n(request):
36 36
         context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE
37 37
     else:
38 38
         context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE
  39
+    
  40
+    from django.utils import translation
  41
+    context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
  42
+
39 43
     return context_extras
40 44
 
41 45
 def request(request):
7  docs/i18n.txt
@@ -230,12 +230,17 @@ Each ``RequestContext`` has access to two translation-specific variables:
230 230
       language code and the second is the language name (in that language).
231 231
     * ``LANGUAGE_CODE`` is the current user's preferred language, as a string.
232 232
       Example: ``en-us``. (See "How language preference is discovered", below.)
  233
+    * ``LANGUAGE_BIDI`` is the current language's direction. If True, it's a
  234
+      right-to-left language, e.g: Hebrew, Arabic. If False it's a
  235
+      left-to-right language, e.g: English, French, German etc.
  236
+
233 237
 
234 238
 If you don't use the ``RequestContext`` extension, you can get those values with
235  
-two tags::
  239
+three tags::
236 240
 
237 241
     {% get_current_language as LANGUAGE_CODE %}
238 242
     {% get_available_languages as LANGUAGES %}
  243
+    {% get_current_language_bidi as LANGUAGE_BIDI %}
239 244
 
240 245
 These tags also require a ``{% load i18n %}``.
241 246
 

0 notes on commit 7e88ec5

Please sign in to comment.
Something went wrong with that request. Please try again.