DOC
This commit is contained in:
parent
426d1fe531
commit
01ca13305c
17
BABEL_USAGE.md
Normal file
17
BABEL_USAGE.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Babel usage
|
||||
Babel will scan and detect sections of code that uses `gettext` or `_` in HTML templates and python code. It takes the constant string passed into its function and makes a translation template which can then be used to build individual translations.
|
||||
|
||||
## Usage
|
||||
If you are compiling and building a template from scratch
|
||||
```
|
||||
$ pybabel extract -F babel.cfg -o messages.pot ./
|
||||
$ pybabel update -i messages.pot -d translations
|
||||
```
|
||||
|
||||
Make translations in the outputted file then compile the translation with
|
||||
```
|
||||
$ pybabel compile -d translations
|
||||
```
|
||||
|
||||
Make sure the `messages.po` file is in the right language directory.
|
||||
Example path: `translations/nb/LC_MESSAGES/messages.po`
|
|
@ -9,7 +9,11 @@ Install the required dependencies with pip
|
|||
```
|
||||
$ pip install -r requirements.txt
|
||||
```
|
||||
then, run the web server
|
||||
Make sure you compile the babel languages
|
||||
```
|
||||
$ pybabel compile -d translations
|
||||
```
|
||||
Lastly, run the web server
|
||||
```
|
||||
$ python3 main.py
|
||||
```
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Flask>=1.0.2
|
||||
Flask-WTF>=0.14.2
|
||||
flask_login>=0.4.1
|
||||
Flask-Babel>=0.12.2
|
||||
bcrypt
|
Loading…
Reference in New Issue
Block a user