This commit is contained in:
Emily 2019-05-12 15:17:22 +01:00
parent 426d1fe531
commit 01ca13305c
3 changed files with 24 additions and 2 deletions

17
BABEL_USAGE.md Normal file
View 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`

View File

@ -9,9 +9,13 @@ 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
```
Configuration can be edited in config.json
Configuration can be edited in config.json

View File

@ -1,4 +1,5 @@
Flask>=1.0.2
Flask-WTF>=0.14.2
flask_login>=0.4.1
Flask-Babel>=0.12.2
bcrypt