1
1
Flask-Babel
2
2
===========
3
3
4
- .. module :: flask.ext.babel
4
+ .. module :: flask_babel
5
5
6
6
Flask-Babel is an extension to `Flask `_ that adds i18n and l10n support to
7
7
any Flask application with the help of `babel `_, `pytz `_ and
@@ -31,7 +31,7 @@ To get started all you need to do is to instanciate a :class:`Babel`
31
31
object after configuring the application::
32
32
33
33
from flask import Flask
34
- from flask.ext.babel import Babel
34
+ from flask_babel import Babel
35
35
36
36
app = Flask(__name__)
37
37
app.config.from_pyfile('mysettings.cfg')
@@ -112,7 +112,7 @@ To play with the date formatting from the console, you can use the
112
112
113
113
Here some examples:
114
114
115
- >>> from flask.ext.babel import format_datetime
115
+ >>> from flask_babel import format_datetime
116
116
>>> from datetime import datetime
117
117
>>> format_datetime(datetime(1987 , 3 , 5 , 17 , 12 ))
118
118
u'Mar 5, 1987 5:12:00 PM'
@@ -128,7 +128,7 @@ u'05 12 1987'
128
128
And again with a different language:
129
129
130
130
>>> app.config[' BABEL_DEFAULT_LOCALE' ] = ' de'
131
- >>> from flask.ext.babel import refresh; refresh()
131
+ >>> from flask_babel import refresh; refresh()
132
132
>>> format_datetime(datetime(1987 , 3 , 5 , 17 , 12 ), ' EEEE, d. MMMM yyyy H:mm' )
133
133
u'Donnerstag, 5. M\xe4rz 1987 17:12'
134
134
@@ -148,7 +148,7 @@ There are two functions responsible for translating: :func:`gettext` and
148
148
:func: `ngettext `. The first to translate singular strings and the second
149
149
to translate strings that might become plural. Here some examples::
150
150
151
- from flask.ext.babel import gettext, ngettext
151
+ from flask_babel import gettext, ngettext
152
152
153
153
gettext(u'A simple string')
154
154
gettext(u'Value: %(value)s', value=42)
@@ -159,7 +159,7 @@ application and define them outside of a request, you can use a lazy
159
159
strings. Lazy strings will not be evaluated until they are actually used.
160
160
To use such a lazy string, use the :func: `lazy_gettext ` function::
161
161
162
- from flask.ext.babel import lazy_gettext
162
+ from flask_babel import lazy_gettext
163
163
164
164
class MyForm(formlibrary.FormBase):
165
165
success_message = lazy_gettext(u'The form was successfully saved.')
0 commit comments