mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	fixed #2089: added language bidirectional support and updated the admin to use it. thanks meir@mksoft!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		
							
								
								
									
										5
									
								
								django/contrib/admin/media/css/base_rtl.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								django/contrib/admin/media/css/base_rtl.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | @import url('base.css'); | ||||||
|  |  | ||||||
|  | body { | ||||||
|  |     direction: rtl; | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								django/contrib/admin/media/css/login_rtl.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								django/contrib/admin/media/css/login_rtl.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | @import url('login.css'); | ||||||
|  | @import url('base_rtl.css'); | ||||||
|  | @import url('layout_rtl.css'); | ||||||
|  |  | ||||||
|  | .login .form-row { float:right; } | ||||||
|  | .login .form-row label { float:right; padding-left:0.5em; padding-right:0; text-align:left;} | ||||||
|  | .login .submit-row { clear:both; padding:1em 9.4em 0 0; } | ||||||
| @@ -2,7 +2,7 @@ | |||||||
| <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}"> | <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}"> | ||||||
| <head> | <head> | ||||||
| <title>{% block title %}{% endblock %}</title> | <title>{% block title %}{% endblock %}</title> | ||||||
| <link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" /> | <link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %}" /> | ||||||
| {% block extrastyle %}{% endblock %} | {% block extrastyle %}{% endblock %} | ||||||
| {% block extrahead %}{% endblock %} | {% block extrahead %}{% endblock %} | ||||||
| </head> | </head> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| {% extends "admin/base_site.html" %} | {% extends "admin/base_site.html" %} | ||||||
| {% load i18n %} | {% load i18n %} | ||||||
|  |  | ||||||
| {% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login.css{% endblock %} | {% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login{% if LANGUAGE_BIDI %}_rtl{% endif %}.css{% endblock %} | ||||||
| {% block bodyclass %}login{% endblock %} | {% block bodyclass %}login{% endblock %} | ||||||
| {% block content_title %}{% endblock %} | {% block content_title %}{% endblock %} | ||||||
| {% block breadcrumbs %}{% endblock %} | {% block breadcrumbs %}{% endblock %} | ||||||
|   | |||||||
| @@ -36,6 +36,10 @@ def i18n(request): | |||||||
|         context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE |         context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE | ||||||
|     else: |     else: | ||||||
|         context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE |         context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE | ||||||
|  |      | ||||||
|  |     from django.utils import translation | ||||||
|  |     context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi() | ||||||
|  |  | ||||||
|     return context_extras |     return context_extras | ||||||
|  |  | ||||||
| def request(request): | def request(request): | ||||||
|   | |||||||
| @@ -230,12 +230,17 @@ Each ``RequestContext`` has access to two translation-specific variables: | |||||||
|       language code and the second is the language name (in that language). |       language code and the second is the language name (in that language). | ||||||
|     * ``LANGUAGE_CODE`` is the current user's preferred language, as a string. |     * ``LANGUAGE_CODE`` is the current user's preferred language, as a string. | ||||||
|       Example: ``en-us``. (See "How language preference is discovered", below.) |       Example: ``en-us``. (See "How language preference is discovered", below.) | ||||||
|  |     * ``LANGUAGE_BIDI`` is the current language's direction. If True, it's a | ||||||
|  |       right-to-left language, e.g: Hebrew, Arabic. If False it's a | ||||||
|  |       left-to-right language, e.g: English, French, German etc. | ||||||
|  |  | ||||||
|  |  | ||||||
| If you don't use the ``RequestContext`` extension, you can get those values with | If you don't use the ``RequestContext`` extension, you can get those values with | ||||||
| two tags:: | three tags:: | ||||||
|  |  | ||||||
|     {% get_current_language as LANGUAGE_CODE %} |     {% get_current_language as LANGUAGE_CODE %} | ||||||
|     {% get_available_languages as LANGUAGES %} |     {% get_available_languages as LANGUAGES %} | ||||||
|  |     {% get_current_language_bidi as LANGUAGE_BIDI %} | ||||||
|  |  | ||||||
| These tags also require a ``{% load i18n %}``. | These tags also require a ``{% load i18n %}``. | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user