Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
820671e1
Commit
820671e1
authored
Apr 11, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ability to override translations path.
parent
c602b40b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
babel.py
flask_adminex/babel.py
+15
-1
base.py
flask_adminex/base.py
+7
-1
No files found.
flask_adminex/babel.py
View file @
820671e1
...
@@ -2,7 +2,21 @@ try:
...
@@ -2,7 +2,21 @@ try:
from
flask.ext.babel
import
Domain
from
flask.ext.babel
import
Domain
from
flask.ext.adminex
import
translations
from
flask.ext.adminex
import
translations
domain
=
Domain
(
translations
.
__path__
[
0
],
domain
=
'admin'
)
class
CustomDomain
(
Domain
):
def
__init__
(
self
):
super
(
CustomDomain
,
self
)
.
__init__
(
translations
.
__path__
[
0
],
domain
=
'admin'
)
def
get_translations_path
(
self
,
ctx
):
print
ctx
dirname
=
ctx
.
app
.
extensions
[
'admin'
]
.
translations_path
if
dirname
is
not
None
:
return
dirname
return
super
(
CustomDomain
,
self
)
.
get_translations_path
(
ctx
)
domain
=
CustomDomain
()
gettext
=
domain
.
gettext
gettext
=
domain
.
gettext
ngettext
=
domain
.
ngettext
ngettext
=
domain
.
ngettext
...
...
flask_adminex/base.py
View file @
820671e1
...
@@ -276,7 +276,8 @@ class Admin(object):
...
@@ -276,7 +276,8 @@ class Admin(object):
"""
"""
Collection of the views. Also manages menu structure.
Collection of the views. Also manages menu structure.
"""
"""
def
__init__
(
self
,
app
=
None
,
name
=
None
,
url
=
None
,
index_view
=
None
):
def
__init__
(
self
,
app
=
None
,
name
=
None
,
url
=
None
,
index_view
=
None
,
translations_path
=
None
):
"""
"""
Constructor.
Constructor.
...
@@ -286,9 +287,14 @@ class Admin(object):
...
@@ -286,9 +287,14 @@ class Admin(object):
Application name. Will be displayed in main menu and as a page title. If not provided, defaulted to "Admin"
Application name. Will be displayed in main menu and as a page title. If not provided, defaulted to "Admin"
`index_view`
`index_view`
Home page view to use. If not provided, will use `AdminIndexView`.
Home page view to use. If not provided, will use `AdminIndexView`.
`translations_path`
Location of the translation message catalogs. By default will use translations
shipped with the Flask-AdminEx.
"""
"""
self
.
app
=
app
self
.
app
=
app
self
.
translations_path
=
translations_path
self
.
_views
=
[]
self
.
_views
=
[]
self
.
_menu
=
[]
self
.
_menu
=
[]
self
.
_menu_categories
=
dict
()
self
.
_menu_categories
=
dict
()
...
...
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