forked from pallets-eco/flask-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
366 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include LICENSE | ||
recursive-include flask_adminex/static * | ||
recursive-include flask_adminex/templates * | ||
recursive-include flask_adminex/translations * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
# Translations template for Flask-AdminEx. | ||
# Copyright (C) 2012 ORGANIZATION | ||
# This file is distributed under the same license as the Flask-AdminEx | ||
# project. | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. | ||
# | ||
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Flask-AdminEx VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2012-04-10 23:45+0300\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 0.9.6\n" | ||
|
||
#: ../flask_adminex/form.py:81 | ||
msgid "Invalid time format" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:32 | ||
msgid "Invalid directory name" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:49 | ||
msgid "File required." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:54 | ||
msgid "Invalid file type." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:335 | ||
msgid "File uploading is disabled." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:344 | ||
#, python-format | ||
msgid "File \"%(name)s\" already exists." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:351 | ||
#, python-format | ||
msgid "Failed to save file: %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:370 | ||
msgid "Directory creation is disabled." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:380 | ||
#, python-format | ||
msgid "Failed to create directory: %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:402 | ||
msgid "Deletion is disabled." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:407 | ||
msgid "Directory deletion is disabled." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:412 | ||
#, python-format | ||
msgid "Directory \"%s\" was successfully deleted." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:414 | ||
#, python-format | ||
msgid "Failed to delete directory: %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:418 | ||
#, python-format | ||
msgid "File \"%(name)s\" was successfully deleted." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:420 | ||
#, python-format | ||
msgid "Failed to delete file: %(name)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:439 | ||
msgid "Renaming is disabled." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:443 | ||
msgid "Path does not exist." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:454 | ||
#, python-format | ||
msgid "Successfully renamed \"%(src)s\" to \"%(dst)s\"" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/fileadmin.py:457 | ||
#, python-format | ||
msgid "Failed to rename: %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/filters.py:35 | ||
msgid "equals" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/filters.py:43 | ||
msgid "not equal" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/filters.py:52 | ||
msgid "contains" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/filters.py:61 | ||
msgid "not contains" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/filters.py:69 | ||
msgid "greater than" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/filters.py:77 | ||
msgid "smaller than" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/form.py:37 | ||
msgid "Already exists." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/view.py:504 | ||
#, python-format | ||
msgid "Failed to create model. %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/view.py:519 | ||
#, python-format | ||
msgid "Failed to update model. %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/ext/sqlamodel/view.py:534 | ||
#, python-format | ||
msgid "Failed to delete model. %(error)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/model/base.py:742 | ||
msgid "Model was successfully created." | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/lib.html:105 | ||
msgid "Submit" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/lib.html:110 | ||
msgid "Cancel" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/file/list.html:7 | ||
msgid "Root" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/file/list.html:42 | ||
#, python-format | ||
msgid "Are you sure you want to delete \\'%(name)s\\' recursively?" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/file/list.html:50 | ||
#, python-format | ||
msgid "Are you sure you want to delete \\'%(name)s\\'?" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/file/list.html:75 | ||
msgid "Upload File" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/file/list.html:78 | ||
msgid "Create Directory" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/file/rename.html:5 | ||
#, python-format | ||
msgid "Please provide new name for %(name)s" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/create.html:11 | ||
msgid "Save and Add" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/create.html:16 | ||
#: ../flask_adminex/templates/admin/model/list.html:12 | ||
msgid "List" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/create.html:19 | ||
#: ../flask_adminex/templates/admin/model/list.html:16 | ||
msgid "Create" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/list.html:23 | ||
msgid "Add Filter" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/list.html:44 | ||
msgid "Search" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/list.html:57 | ||
msgid "Apply" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/list.html:59 | ||
msgid "Reset Filters" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/list.html:67 | ||
msgid "Remove Filter" | ||
msgstr "" | ||
|
||
#: ../flask_adminex/templates/admin/model/list.html:128 | ||
msgid "You sure you want to delete this item?" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pybabel extract -F babel.ini -k _gettext -k _ngettext -o admin.pot --project Flask-AdminEx ..\flask_adminex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Python | ||
[python: **.py] | ||
# Jinja2 | ||
[jinja2: **/templates/**.html] | ||
encoding = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
pybabel extract -F babel.ini -k _gettext -k _ngettext -o admin.pot --project Flask-AdminEx ../flask_adminex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,91 @@ | ||
from __future__ import absolute_import | ||
|
||
import os.path as op | ||
from flask import _request_ctx_stack | ||
|
||
|
||
def _gettext(string, **variables): | ||
return string % variables | ||
try: | ||
from babel import support, Locale | ||
from speaklater import make_lazy_string | ||
|
||
class Namespace(object): | ||
def __init__(self, dirname=None, namespace='', default_locale='en'): | ||
self.dirname = dirname | ||
self.namespace = namespace | ||
self.default_locale = Locale.parse(default_locale) | ||
|
||
def _ngettext(singular, plural, num, **variables): | ||
return (singular if num == 1 else plural) % variables | ||
def _get_locale(self): | ||
ctx = _request_ctx_stack.top | ||
if ctx is None: | ||
return None | ||
|
||
locale = getattr(ctx, 'admin_locale', None) | ||
if locale is None: | ||
admin = ctx.app.extensions['admin'] | ||
|
||
def _lazy_gettext(string, **variables): | ||
return string % variables | ||
if admin.locale_selector_func: | ||
locale_name = admin.locale_selector_func() | ||
|
||
# Wrap flask-babel API | ||
try: | ||
from flask.ext import babel | ||
if locale_name: | ||
locale = Locale.parse(locale_name) | ||
else: | ||
locale = self.default_locale | ||
else: | ||
locale = self.default_locale | ||
|
||
ctx.admin_locale = locale | ||
|
||
return locale | ||
|
||
def _get_translations(self): | ||
ctx = _request_ctx_stack.top | ||
if ctx is None: | ||
return None | ||
|
||
attr = 'admin_trans_' + self.namespace | ||
|
||
translations = getattr(ctx, attr, None) | ||
if translations is None: | ||
dirname = self.dirname or op.join(ctx.app.root_path, 'translations') | ||
translations = support.Translations.load(dirname, | ||
[self._get_locale()], | ||
domain=self.namespace) | ||
setattr(ctx, attr, translations) | ||
|
||
return translations | ||
|
||
def gettext(self, string, **variables): | ||
translations = self._get_translations() | ||
return translations.ugettext(string, **variables) | ||
|
||
def ngettext(self, singular, plural, num, **variables): | ||
translations = self._get_translations() | ||
return translations.ungettext(singular, plural, num, **variables) | ||
|
||
def _is_babel_on(): | ||
ctx = _request_ctx_stack.top | ||
if ctx is None: | ||
return False | ||
def lazy_gettext(self, string, **variables): | ||
return make_lazy_string(self.gettext, string, **variables) | ||
|
||
return hasattr(ctx, 'babel_locale') | ||
except ImportError, ex: | ||
class DummyNamespace(object): | ||
def __init__(self, dirname=None, namespace='admin'): | ||
self.dirname = dirname | ||
self.namespace = namespace | ||
|
||
def gettext(string, **variables): | ||
if not _is_babel_on(): | ||
return _gettext(string, **variables) | ||
def gettext(self, string, **variables): | ||
return string % variables | ||
|
||
return babel.gettext(string, **variables) | ||
def ngettext(self, singular, plural, num, **variables): | ||
return (singular if num == 1 else plural) % variables | ||
|
||
def ngettext(singular, plural, num, **variables): | ||
if not _is_babel_on(): | ||
return _ngettext(singular, plural, num, **variables) | ||
def lazy_gettext(self, string, **variables): | ||
return string % variables | ||
|
||
return babel.ngettext(singular, plural, num, **variables) | ||
Namespace = DummyNamespace | ||
|
||
def lazy_gettext(string, **variables): | ||
from speaklater import make_lazy_string | ||
return make_lazy_string(gettext, string, **variables) | ||
# Create default namespace pointing to the flask-adminex localization directory | ||
ns = Namespace(namespace='admin') | ||
|
||
except ImportError: | ||
gettext = _gettext | ||
ngettext = _ngettext | ||
lazy_gettext = _lazy_gettext | ||
# Create shortcuts for default namespace | ||
gettext = ns.gettext | ||
ngettext = ns.ngettext | ||
lazy_gettext = ns.lazy_gettext |
Oops, something went wrong.