Add web API endpoint get configured language

This commit is contained in:
Chris Witterholt 2024-03-28 03:17:33 +00:00 committed by Raoul Snyman
parent f2484d170a
commit fd45bba951
2 changed files with 13 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from flask import jsonify, request, abort, Blueprint
from PyQt5 import QtCore
from openlp.core.api.lib import login_required
from openlp.core.common.i18n import LanguageManager
from openlp.core.common.registry import Registry
from openlp.core.lib.plugin import PluginStatus, StringContent
from openlp.core.state import State
@ -82,6 +83,12 @@ def system_information():
return jsonify(data)
@core.route('/language')
def language():
language = LanguageManager.get_language()
return jsonify({'language': language})
@core.route('/login', methods=['POST'])
def login():
data = request.json

View File

@ -69,6 +69,12 @@ def test_shortcuts(flask_client: FlaskClient, settings: Settings):
assert res.get_json()[0]['shortcut'] == shortcut
def test_language(flask_client: FlaskClient, settings: Settings):
res = flask_client.get('/api/v2/core/language')
assert res.status_code == 200
assert res.get_json()['language']
def test_poll_backend(settings: Settings):
"""
Test the raw poll function returns the correct JSON