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
2833d1e9
Commit
2833d1e9
authored
Sep 16, 2016
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL-603 load locale paths for themes directories
parent
dd876d8b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
4 deletions
+72
-4
cms/envs/aws.py
+7
-0
cms/envs/common.py
+3
-0
lms/envs/aws.py
+7
-0
lms/envs/common.py
+3
-0
lms/envs/test.py
+1
-0
openedx/core/djangoapps/theming/core.py
+12
-4
openedx/core/djangoapps/theming/tests/test_theme_locales.py
+26
-0
themes/conf/locale/en/LC_MESSAGES/django.po
+13
-0
No files found.
cms/envs/aws.py
View file @
2833d1e9
...
...
@@ -215,6 +215,13 @@ if ENV_TOKENS.get('COMPREHENSIVE_THEME_DIR', None):
COMPREHENSIVE_THEME_DIR
=
ENV_TOKENS
.
get
(
'COMPREHENSIVE_THEME_DIR'
)
COMPREHENSIVE_THEME_DIRS
=
ENV_TOKENS
.
get
(
'COMPREHENSIVE_THEME_DIRS'
,
COMPREHENSIVE_THEME_DIRS
)
or
[]
# COMPREHENSIVE_THEME_LOCALE_PATHS contain the paths to themes locale directories e.g.
# "COMPREHENSIVE_THEME_LOCALE_PATHS" : [
# "/edx/src/edx-themes/conf/locale"
# ],
COMPREHENSIVE_THEME_LOCALE_PATHS
=
ENV_TOKENS
.
get
(
'COMPREHENSIVE_THEME_LOCALE_PATHS'
,
[])
DEFAULT_SITE_THEME
=
ENV_TOKENS
.
get
(
'DEFAULT_SITE_THEME'
,
DEFAULT_SITE_THEME
)
ENABLE_COMPREHENSIVE_THEMING
=
ENV_TOKENS
.
get
(
'ENABLE_COMPREHENSIVE_THEMING'
,
ENABLE_COMPREHENSIVE_THEMING
)
...
...
cms/envs/common.py
View file @
2833d1e9
...
...
@@ -1190,3 +1190,6 @@ AFFILIATE_COOKIE_NAME = 'affiliate_id'
############## Settings for Studio Context Sensitive Help ##############
DOC_LINK_BASE_URL
=
None
# Theme directory locale paths
COMPREHENSIVE_THEME_LOCALE_PATHS
=
[]
lms/envs/aws.py
View file @
2833d1e9
...
...
@@ -274,6 +274,13 @@ if ENV_TOKENS.get('COMPREHENSIVE_THEME_DIR', None):
COMPREHENSIVE_THEME_DIR
=
ENV_TOKENS
.
get
(
'COMPREHENSIVE_THEME_DIR'
)
COMPREHENSIVE_THEME_DIRS
=
ENV_TOKENS
.
get
(
'COMPREHENSIVE_THEME_DIRS'
,
COMPREHENSIVE_THEME_DIRS
)
or
[]
# COMPREHENSIVE_THEME_LOCALE_PATHS contain the paths to themes locale directories e.g.
# "COMPREHENSIVE_THEME_LOCALE_PATHS" : [
# "/edx/src/edx-themes/conf/locale"
# ],
COMPREHENSIVE_THEME_LOCALE_PATHS
=
ENV_TOKENS
.
get
(
'COMPREHENSIVE_THEME_LOCALE_PATHS'
,
[])
DEFAULT_SITE_THEME
=
ENV_TOKENS
.
get
(
'DEFAULT_SITE_THEME'
,
DEFAULT_SITE_THEME
)
ENABLE_COMPREHENSIVE_THEMING
=
ENV_TOKENS
.
get
(
'ENABLE_COMPREHENSIVE_THEMING'
,
ENABLE_COMPREHENSIVE_THEMING
)
...
...
lms/envs/common.py
View file @
2833d1e9
...
...
@@ -2950,6 +2950,9 @@ SITE_ID = 1
# dir containing all themes
COMPREHENSIVE_THEME_DIRS
=
[
REPO_ROOT
/
"themes"
]
# Theme directory locale paths
COMPREHENSIVE_THEME_LOCALE_PATHS
=
[]
# Theme to use when no site or site theme is defined,
# set to None if you want to use openedx theme
DEFAULT_SITE_THEME
=
None
...
...
lms/envs/test.py
View file @
2833d1e9
...
...
@@ -588,6 +588,7 @@ OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
COURSE_CATALOG_API_URL
=
'https://catalog.example.com/api/v1'
COMPREHENSIVE_THEME_DIRS
=
[
REPO_ROOT
/
"themes"
,
REPO_ROOT
/
"common/test"
]
COMPREHENSIVE_THEME_LOCALE_PATHS
=
[
REPO_ROOT
/
"themes/conf/locale"
,
]
LMS_ROOT_URL
=
"http://localhost:8000"
...
...
openedx/core/djangoapps/theming/core.py
View file @
2833d1e9
...
...
@@ -2,6 +2,7 @@
Core logic for Comprehensive Theming.
"""
from
django.conf
import
settings
from
path
import
Path
as
path
from
.helpers
import
get_themes
...
...
@@ -21,9 +22,16 @@ def enable_theming():
)
for
theme
in
get_themes
():
locale_dir
=
theme
.
path
/
"conf"
/
"locale"
if
locale_dir
.
isdir
():
settings
.
LOCALE_PATHS
=
(
locale_dir
,
)
+
settings
.
LOCALE_PATHS
if
theme
.
themes_base_dir
not
in
settings
.
MAKO_TEMPLATES
[
'main'
]:
settings
.
MAKO_TEMPLATES
[
'main'
]
.
insert
(
0
,
theme
.
themes_base_dir
)
_add_theming_locales
()
def
_add_theming_locales
():
"""
Add locale paths to settings for comprehensive theming.
"""
theme_locale_paths
=
settings
.
COMPREHENSIVE_THEME_LOCALE_PATHS
for
locale_path
in
theme_locale_paths
:
settings
.
LOCALE_PATHS
+=
(
path
(
locale_path
),
)
# pylint: disable=no-member
openedx/core/djangoapps/theming/tests/test_theme_locales.py
0 → 100644
View file @
2833d1e9
"""
Tests for Themeing locales
"""
import
unittest
from
django.conf
import
settings
from
django.test
import
TestCase
import
os
class
TestComprehensiveThemeLocale
(
TestCase
):
"""
Test Comprehensive Theme Locales
"""
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
def
test_theme_locale_path_in_settings
(
self
):
"""
test comprehensive theming paths in settings.
"""
self
.
assertIn
(
settings
.
REPO_ROOT
/
'themes/conf/locale'
,
settings
.
LOCALE_PATHS
)
# pylint: disable=no-member
def
test_theme_locale_path_exist
(
self
):
"""
test comprehensive theming directory path exist.
"""
self
.
assertTrue
(
os
.
path
.
exists
(
settings
.
REPO_ROOT
/
"themes/conf/locale"
))
themes/conf/locale/en/LC_MESSAGES/django.po
0 → 100644
View file @
2833d1e9
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2016-09-01 10:46+0500\n"
"PO-Revision-Date: 2016-09-01 10:48+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en\n"
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