mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
add German language translation data #95
This commit is contained in:
parent
a121b316d5
commit
fed38857f8
5 changed files with 650 additions and 710 deletions
|
@ -19,6 +19,13 @@ from sqlalchemy_searchable import make_searchable
|
||||||
from config import Config
|
from config import Config
|
||||||
|
|
||||||
|
|
||||||
|
def get_locale():
|
||||||
|
try:
|
||||||
|
return request.accept_languages.best_match(current_app.config['LANGUAGES'])
|
||||||
|
except:
|
||||||
|
return 'en'
|
||||||
|
|
||||||
|
|
||||||
db = SQLAlchemy() # engine_options={'pool_size': 5, 'max_overflow': 10} # session_options={"autoflush": False}
|
db = SQLAlchemy() # engine_options={'pool_size': 5, 'max_overflow': 10} # session_options={"autoflush": False}
|
||||||
migrate = Migrate()
|
migrate = Migrate()
|
||||||
login = LoginManager()
|
login = LoginManager()
|
||||||
|
@ -27,7 +34,7 @@ login.login_message = _l('Please log in to access this page.')
|
||||||
mail = Mail()
|
mail = Mail()
|
||||||
bootstrap = Bootstrap5()
|
bootstrap = Bootstrap5()
|
||||||
moment = Moment()
|
moment = Moment()
|
||||||
babel = Babel()
|
babel = Babel(locale_selector=get_locale)
|
||||||
cache = Cache()
|
cache = Cache()
|
||||||
celery = Celery(__name__, broker=Config.CELERY_BROKER_URL)
|
celery = Celery(__name__, broker=Config.CELERY_BROKER_URL)
|
||||||
|
|
||||||
|
@ -130,11 +137,4 @@ def create_app(config_class=Config):
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
def get_locale():
|
|
||||||
try:
|
|
||||||
return request.accept_languages.best_match(current_app.config['LANGUAGES'])
|
|
||||||
except:
|
|
||||||
return 'en_US'
|
|
||||||
|
|
||||||
|
|
||||||
from app import models
|
from app import models
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,7 +22,7 @@ class Config(object):
|
||||||
RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY")
|
RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY")
|
||||||
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
|
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
|
||||||
MODE = os.environ.get('MODE') or 'development'
|
MODE = os.environ.get('MODE') or 'development'
|
||||||
LANGUAGES = ['en']
|
LANGUAGES = ['de', 'en']
|
||||||
FULL_AP_CONTEXT = bool(int(os.environ.get('FULL_AP_CONTEXT', 0)))
|
FULL_AP_CONTEXT = bool(int(os.environ.get('FULL_AP_CONTEXT', 0)))
|
||||||
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
||||||
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
||||||
|
|
|
@ -5,5 +5,6 @@ sudo systemctl stop celery.service
|
||||||
git pull
|
git pull
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
flask db upgrade
|
flask db upgrade
|
||||||
|
flask translate compile
|
||||||
sudo systemctl start celery.service
|
sudo systemctl start celery.service
|
||||||
sudo systemctl restart pyfedi.service
|
sudo systemctl restart pyfedi.service
|
||||||
|
|
|
@ -16,3 +16,18 @@ python profile_app.py
|
||||||
instead of
|
instead of
|
||||||
flask run
|
flask run
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
translations:
|
||||||
|
|
||||||
|
See https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiii-i18n-and-l10n-2018
|
||||||
|
|
||||||
|
to add a new language which can be worked on:
|
||||||
|
|
||||||
|
pybabel init -i messages.pot -d app/translations -l <language code>
|
||||||
|
|
||||||
|
after changes to the files in app/translations/* are mode, they need to be compiled
|
||||||
|
pybabel compile -d app/translations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue