def handle_language():
    session_store = get_session_store()
    if session_store:
        launch_language = (session_store.session_data.launch_language_code
                           or DEFAULT_LANGUAGE_CODE)
        g.allowed_languages = get_allowed_languages(
            session_store.session_data.schema_name, launch_language)
        request_language = request.args.get("language_code")
        if request_language and request_language in g.allowed_languages:
            session_store.session_data.language_code = request_language
            session_store.save()
예제 #2
0
def test_get_allowed_languages(schema_name, launch_language, expected):
    assert get_allowed_languages(schema_name, launch_language) == expected