Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
35b36992
authored
Feb 06, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: user configurable locale support
parent
60ceab11
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
cloud/settings.py
+1
-0
cloud/urls.py
+1
-0
one/templates/base.html
+3
-6
school/views.py
+21
-0
No files found.
cloud/settings.py
View file @
35b36992
...
@@ -92,6 +92,7 @@ TEMPLATE_LOADERS = (
...
@@ -92,6 +92,7 @@ TEMPLATE_LOADERS = (
MIDDLEWARE_CLASSES
=
(
MIDDLEWARE_CLASSES
=
(
'django.middleware.common.CommonMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.locale.LocaleMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'django.middleware.transaction.TransactionMiddleware'
,
'django.middleware.transaction.TransactionMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
...
...
cloud/urls.py
View file @
35b36992
...
@@ -35,4 +35,5 @@ urlpatterns = patterns('',
...
@@ -35,4 +35,5 @@ urlpatterns = patterns('',
url
(
r'^ajax/store/newFolder$'
,
'store.views.ajax_new_folder'
,
name
=
'store_ajax_new_folder'
),
url
(
r'^ajax/store/newFolder$'
,
'store.views.ajax_new_folder'
,
name
=
'store_ajax_new_folder'
),
url
(
r'^ajax/store/quota$'
,
'store.views.ajax_quota'
,
name
=
'store_ajax_quota'
),
url
(
r'^ajax/store/quota$'
,
'store.views.ajax_quota'
,
name
=
'store_ajax_quota'
),
url
(
r'^ajax/store/rename$'
,
'store.views.ajax_rename'
,
name
=
'store_ajax_rename'
),
url
(
r'^ajax/store/rename$'
,
'store.views.ajax_rename'
,
name
=
'store_ajax_rename'
),
url
(
r'^language/(?P<lang>[-A-Za-z]+)/$'
,
'school.views.language'
,
name
=
'language'
),
)
)
one/templates/base.html
View file @
35b36992
...
@@ -31,14 +31,11 @@
...
@@ -31,14 +31,11 @@
{% else %}
{% else %}
<a
href=
"/login/"
>
Bejelentkezés
</a>
.
<a
href=
"/login/"
>
Bejelentkezés
</a>
.
{% endif %}
{% endif %}
<!--
{% if lang == 'hu' %}
{% if lang == 'hu' %}
<a href="/language/en
-US
/">In English</a>.
<a
href=
"/language/en/"
>
In English
</a>
.
{% else %}
{% else %}
<a
href=
"/language/hu/"
>
Magyarul
</a>
.
<a
href=
"/language/hu/"
>
Magyarul
</a>
.
{% if autolang %}
{% endif %}
<p style="position: absolute; top: 40px; right: 1em;" class="triangle-border top">Böngészője kifejezetten angol tartalmat kért.<br/>A <a href="/language/hu/">magyar változat</a> részletesebb és frissebb!</p>
{% endif %}
{% endif %}-->
</p>
</p>
</div>
</div>
{% endblock %}
{% endblock %}
...
...
school/views.py
View file @
35b36992
...
@@ -114,3 +114,24 @@ def login(request):
...
@@ -114,3 +114,24 @@ def login(request):
response
=
redirect
(
redirect_to
)
response
=
redirect
(
redirect_to
)
response
.
set_cookie
(
settings
.
LANGUAGE_COOKIE_NAME
,
p
.
language
,
10
*
365
*
24
*
3600
)
response
.
set_cookie
(
settings
.
LANGUAGE_COOKIE_NAME
,
p
.
language
,
10
*
365
*
24
*
3600
)
return
response
return
response
def
language
(
request
,
lang
):
cname
=
settings
.
LANGUAGE_COOKIE_NAME
if
not
cname
:
cname
=
'django_language'
redirect_to
=
request
.
META
[
'HTTP_REFERER'
]
r
=
redirect
(
redirect_to
)
if
not
redirect_to
:
redirect_to
=
"/"
try
:
p
=
Person
.
objects
.
get
(
user
=
request
.
user
)
p
.
language
=
lang
p
.
save
()
except
ValidationError
as
e
:
messages
.
error
(
e
)
except
:
messages
.
error
(
_
(
"Could not found Person object."
))
r
.
set_cookie
(
cname
,
lang
,
10
*
365
*
24
*
3600
)
return
r
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment