Last active
August 29, 2015 14:14
-
-
Save shinux/5e41e6f7fc1a28946dd2 to your computer and use it in GitHub Desktop.
Reproduce the bug in https://github.com/mrjoes/flask-admin/issues/781
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
[python: **.py] | |
[jinja2: **/templates/**.html] | |
extensions=jinja2.ext.autoescape,jinja2.ext.with_ |
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
# Chinese translations for PROJECT. | |
# Copyright (C) 2015 ORGANIZATION | |
# This file is distributed under the same license as the PROJECT project. | |
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015. | |
# | |
# | |
msgid "" | |
msgstr "" | |
"Project-Id-Version: PROJECT VERSION\n" | |
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | |
"POT-Creation-Date: 2015-02-03 15:45+0800\n" | |
"PO-Revision-Date: 2015-02-03 15:45+0800\n" | |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
"Language-Team: zh <[email protected]>\n" | |
"Plural-Forms: nplurals=2; plural=(n != 1)\n" | |
"MIME-Version: 1.0\n" | |
"Content-Type: text/plain; charset=utf-8\n" | |
"Content-Transfer-Encoding: 8bit\n" | |
"Generated-By: Babel 1.3\n" | |
#: translations.py:9 | |
msgid "My App" | |
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
# -*- coding: utf-8 -*- | |
from flask import Flask, redirect | |
from flask.ext.admin import Admin, BaseView, expose | |
from flask.ext.babel import lazy_gettext | |
from flask_babelex import Babel | |
babel = Babel() | |
@babel.localeselector | |
def get_locale(): | |
return 'zh' | |
app = Flask(__name__) | |
babel.init_app(app) | |
admin = Admin(app, name=lazy_gettext('My App')) | |
@app.route('/') | |
def to_admin(): | |
return redirect('/admin') | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put the file above in same level. run