Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6d50ff7b
Commit
6d50ff7b
authored
Jan 27, 2014
by
Dave St.Germain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the html language to the browser's specified language
parent
b615de57
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
54 additions
and
25 deletions
+54
-25
cms/envs/common.py
+3
-1
cms/templates/base.html
+5
-5
lms/djangoapps/courseware/tests/test_i18n.py
+25
-0
lms/envs/common.py
+3
-2
lms/envs/test.py
+1
-0
lms/static/maintenance/index.html
+1
-1
lms/templates/course_groups/debug.html
+1
-1
lms/templates/extauth_failure.html
+1
-1
lms/templates/main.html
+5
-5
lms/templates/main_django.html
+2
-2
lms/templates/mktg_iframe.html
+4
-4
lms/templates/registration/password_reset_complete.html
+1
-1
lms/templates/registration/password_reset_confirm.html
+1
-1
lms/templates/wiki/preview_inline.html
+1
-1
No files found.
cms/envs/common.py
View file @
6d50ff7b
...
...
@@ -113,6 +113,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request'
,
'django.core.context_processors.static'
,
'django.contrib.messages.context_processors.messages'
,
'django.core.context_processors.i18n'
,
'django.contrib.auth.context_processors.auth'
,
# this is required for admin
'django.core.context_processors.csrf'
,
'dealer.contrib.django.staff.context_processor'
,
# access git revision
...
...
@@ -165,12 +166,13 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware'
,
'track.middleware.TrackMiddleware'
,
'edxmako.middleware.MakoMiddleware'
,
# Detects user-requested locale from 'accept-language' header in http request
'django.middleware.locale.LocaleMiddleware'
,
'django.middleware.transaction.TransactionMiddleware'
,
# needs to run after locale middleware (or anything that modifies the request context)
'edxmako.middleware.MakoMiddleware'
,
# catches any uncaught RateLimitExceptions and returns a 403 instead of a 500
'ratelimitbackend.middleware.RateLimitMiddleware'
,
...
...
cms/templates/base.html
View file @
6d50ff7b
...
...
@@ -3,10 +3,10 @@
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<!doctype html>
<!--[if IE 7]><html class="ie7 lte9 lte8 lte7"><![endif]-->
<!--[if IE 8]><html class="ie8 lte9 lte8"><![endif]-->
<!--[if IE 9]><html class="ie9 lte9"><![endif]-->
<!--[if gt IE 9]><!-->
<html>
<!--<![endif]-->
<!--[if IE 7]><html class="ie7 lte9 lte8 lte7"
lang="${LANGUAGE_CODE}"
><![endif]-->
<!--[if IE 8]><html class="ie8 lte9 lte8"
lang="${LANGUAGE_CODE}"
><![endif]-->
<!--[if IE 9]><html class="ie9 lte9"
lang="${LANGUAGE_CODE}"
><![endif]-->
<!--[if gt IE 9]><!-->
<html
lang=
"${LANGUAGE_CODE}"
>
<!--<![endif]-->
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
...
...
@@ -32,7 +32,7 @@
<
%
block
name=
"header_extras"
></
%
block>
</head>
<body
class=
"<%block name='bodyclass'></%block> hide-wip"
>
<body
class=
"<%block name='bodyclass'></%block> hide-wip
lang_${LANGUAGE_CODE}
"
>
<a
class=
"nav-skip"
href=
"#content"
>
${_("Skip to this view's content")}
</a>
<script
type=
"text/javascript"
>
...
...
lms/djangoapps/courseware/tests/test_i18n.py
0 → 100644
View file @
6d50ff7b
"""
Tests i18n in courseware
"""
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
import
re
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
,
LANGUAGES
=
((
'eo'
,
'Esperanto'
),))
class
I18nTestCase
(
TestCase
):
"""
Tests for i18n
"""
def
test_default_is_en
(
self
):
response
=
self
.
client
.
get
(
'/'
)
self
.
assertIn
(
'<html lang="en">'
,
response
.
content
)
self
.
assertEqual
(
response
[
'Content-Language'
],
'en'
)
self
.
assertTrue
(
re
.
search
(
'<body.*class=".*lang_en">'
,
response
.
content
))
def
test_esperanto
(
self
):
response
=
self
.
client
.
get
(
'/'
,
HTTP_ACCEPT_LANGUAGE
=
'eo'
)
self
.
assertIn
(
'<html lang="eo">'
,
response
.
content
)
self
.
assertEqual
(
response
[
'Content-Language'
],
'eo'
)
self
.
assertTrue
(
re
.
search
(
'<body.*class=".*lang_eo">'
,
response
.
content
))
lms/envs/common.py
View file @
6d50ff7b
...
...
@@ -277,7 +277,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request'
,
'django.core.context_processors.static'
,
'django.contrib.messages.context_processors.messages'
,
#
'django.core.context_processors.i18n',
'django.core.context_processors.i18n'
,
'django.contrib.auth.context_processors.auth'
,
# this is required for admin
'django.core.context_processors.csrf'
,
...
...
@@ -635,7 +635,6 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware'
,
'track.middleware.TrackMiddleware'
,
'edxmako.middleware.MakoMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'course_wiki.course_nav.Middleware'
,
...
...
@@ -651,6 +650,8 @@ MIDDLEWARE_CLASSES = (
# catches any uncaught RateLimitExceptions and returns a 403 instead of a 500
'ratelimitbackend.middleware.RateLimitMiddleware'
,
# needs to run after locale middleware (or anything that modifies the request context)
'edxmako.middleware.MakoMiddleware'
,
# For A/B testing
'waffle.middleware.WaffleMiddleware'
,
...
...
lms/envs/test.py
View file @
6d50ff7b
...
...
@@ -73,6 +73,7 @@ COMMON_TEST_DATA_ROOT = COMMON_ROOT / "test" / "data"
# Where the content data is checked out. This may not exist on jenkins.
GITHUB_REPO_ROOT
=
ENV_ROOT
/
"data"
USE_I18N
=
True
XQUEUE_INTERFACE
=
{
"url"
:
"http://sandbox-xqueue.edx.org"
,
...
...
lms/static/maintenance/index.html
View file @
6d50ff7b
<!doctype html>
<html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<link
href=
'http://fonts.googleapis.com/css?family=Open+Sans:300'
rel=
'stylesheet'
type=
'text/css'
>
...
...
lms/templates/course_groups/debug.html
View file @
6d50ff7b
<!DOCTYPE html>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<html>
<html
lang=
"${LANGUAGE_CODE}"
>
<head>
## "edX" should not be translated
<
%
block
name=
"title"
><title>
edX
</title></
%
block>
...
...
lms/templates/extauth_failure.html
View file @
6d50ff7b
...
...
@@ -2,7 +2,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<html
lang=
"${LANGUAGE_CODE}"
>
<head>
<title>
${_("External Authentication failed")}
</title>
</head>
...
...
lms/templates/main.html
View file @
6d50ff7b
...
...
@@ -22,10 +22,10 @@
</
%
def>
<!DOCTYPE html>
<!--[if IE 7]><html class="ie ie7 lte9 lte8 lte7" lang="
en-us
"><![endif]-->
<!--[if IE 8]><html class="ie ie8 lte9 lte8" lang="
en-us
"><![endif]-->
<!--[if IE 9]><html class="ie ie9 lte9" lang="
en-us
"><![endif]-->
<!--[if gt IE 9]><!-->
<html
lang=
"
en-us
"
>
<!--<![endif]-->
<!--[if IE 7]><html class="ie ie7 lte9 lte8 lte7" lang="
${LANGUAGE_CODE}
"><![endif]-->
<!--[if IE 8]><html class="ie ie8 lte9 lte8" lang="
${LANGUAGE_CODE}
"><![endif]-->
<!--[if IE 9]><html class="ie ie9 lte9" lang="
${LANGUAGE_CODE}
"><![endif]-->
<!--[if gt IE 9]><!-->
<html
lang=
"
${LANGUAGE_CODE}
"
>
<!--<![endif]-->
<head>
<
%
block
name=
"title"
>
% if stanford_theme_enabled():
...
...
@@ -102,7 +102,7 @@
</head>
<body
class=
"<%block name='bodyclass'/>"
>
<body
class=
"<%block name='bodyclass'/>
lang_${LANGUAGE_CODE}
"
>
<a
class=
"nav-skip"
href=
"#content"
>
${_("Skip to this view's content")}
</a>
<
%
include
file=
"mathjax_accessible.html"
/>
...
...
lms/templates/main_django.html
View file @
6d50ff7b
<!DOCTYPE html>
{% load compressed %}{% load sekizai_tags i18n %}{% load url from future %}{% load staticfiles %}
<html>
<html
lang=
"{{LANGUAGE_CODE}}"
>
<head>
{# "edX" should *not* be translated #}
{% block title %}
<title>
edX
</title>
{% endblock %}
...
...
@@ -28,7 +28,7 @@
<meta
name=
"path_prefix"
content=
"{{EDX_ROOT_URL}}"
>
</head>
<body
class=
"{% block bodyclass %}{% endblock %}"
>
<body
class=
"{% block bodyclass %}{% endblock %}
lang_{{LANGUAGE_CODE}}
"
>
<a
class=
"nav-skip"
href=
"#content"
>
{% trans "Skip to this view's content" %}
</a>
{% include "navigation.html" %}
<section
class=
"content-wrapper"
id=
"content"
>
...
...
lms/templates/mktg_iframe.html
View file @
6d50ff7b
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<!DOCTYPE html>
<!--[if IE 7]><html class="ie ie7 lte9 lte8 lte7 view-iframe"><![endif]-->
<!--[if IE 8]><html class="ie ie8 lte9 lte8 view-iframe"><![endif]-->
<!--[if IE 9]><html class="ie ie9 lte9 view-iframe"><![endif]-->
<!--[if gt IE 9]><!-->
<html
class=
"view-iframe"
>
<!--<![endif]-->
<!--[if IE 7]><html class="ie ie7 lte9 lte8 lte7 view-iframe"
lang="${LANGUAGE_CODE}"
><![endif]-->
<!--[if IE 8]><html class="ie ie8 lte9 lte8 view-iframe"
lang="${LANGUAGE_CODE}"
><![endif]-->
<!--[if IE 9]><html class="ie ie9 lte9 view-iframe"
lang="${LANGUAGE_CODE}"
><![endif]-->
<!--[if gt IE 9]><!-->
<html
class=
"view-iframe"
lang=
"${LANGUAGE_CODE}"
>
<!--<![endif]-->
<head>
<
%
block
name=
"title"
></
%
block>
...
...
lms/templates/registration/password_reset_complete.html
View file @
6d50ff7b
...
...
@@ -2,7 +2,7 @@
{% load compressed %}
{% load staticfiles %}
<!DOCTYPE html>
<html>
<html
lang=
"{{LANGUAGE_CODE}}"
>
<head>
<title>
{% trans "Your Password Reset is Complete" %}
</title>
...
...
lms/templates/registration/password_reset_confirm.html
View file @
6d50ff7b
...
...
@@ -2,7 +2,7 @@
{% load compressed %}
{% load staticfiles %}
<!DOCTYPE html>
<html>
<html
lang=
"{{LANGUAGE_CODE}}"
>
<head>
<title>
...
...
lms/templates/wiki/preview_inline.html
View file @
6d50ff7b
<!DOCTYPE html>
{% load wiki_tags i18n %}{% load compressed %}
<html>
<html
lang=
"{{LANGUAGE_CODE}}"
>
<head>
{% compressed_css 'course' %}
{% compressed_js 'main_vendor' %}
...
...
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