개발/Python

Pybabel을 이용한 다국어 처리

과녁스 2020. 4. 7. 13:06

1. Flask-babel(PyBabel) 설치

  - pip install flask-babel

2. babel.cfg 파일 작성

[python: **.py]
[jinja2: **/templates/**.html]

3. pybabel extract -F babel.cfg -o messages.pot ./
4. pybabel init -I messages.pot -d ./translations -l ko
5. pybabel compile -f -d translations